Jquery slibings selects the implementation code for the other elements in the same class

  • 2020-03-29 23:45:51
  • OfStack


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


< img border = 0 SRC = "/ / files.jb51.net/file_images/article/201311/20131115151550.gif" >

For example, click "today's ranking", "this week's ranking" and "this month's ranking" to display the bottom underline. You can show the hidden style through the above jquery code.

Related articles: