jQuery closest class selector

后端 未结 6 563
野的像风
野的像风 2021-01-01 10:19
Click me
Information
6条回答
  •  孤城傲影
    2021-01-01 11:00

    jQuery's .closest() method doesn't select sibling selectors, but parents. Looks like you're looking for the .siblings() method.

    $('.Level2').click(function(){
       $(this).siblings('.Level3').fadeToggle();
    });
    

提交回复
热议问题