jquery slibings选取同级其他元素的实现代码


复制代码 代码如下:

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




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

Copyright © 2016 phpStudy | 豫ICP备2021030365号-3