jquery slibings选取同级其余元素

jquery选取同级其余元素能够使用slibings方法,end方法能够清除以前的链式操做,至关于从新开始。javascript

<script type="text/javascript">
$(function(){
    $("#downloadchartsright .chartstitleopt,#downloadchartsleft .chartstitleopt").click(function(){
        $(this).siblings().removeClass('underline').end().addClass('underline');
    });
})
</script>


好比点击“今日排名”“本周排名”“本月排名”显示底部下划线,能够经过以上jquery代码显示隐藏样式。java

(原文:http://tanteng.sinaapp.com/jquery-slibings/)jquery

相关文章
相关标签/搜索