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

相關文章
相關標籤/搜索