Welcome 微信登录

首页 / 脚本样式 / JavaScript / jquery slibings选取同级其他元素的实现代码

复制代码 代码如下:
<script type="text/javascript">
$(function(){
    $("#downloadchartsright .chartstitleopt,#downloadchartsleft .chartstitleopt").click(function(){
        $(this).siblings().removeClass("underline").end().addClass("underline");
    });
})
</script>




比如点击“今日排名”“本周排名”“本月排名”显示底部下划线,可以通过以上jquery代码显示隐藏样式。