Select current element in jQuery

前端 未结 5 830
无人共我
无人共我 2020-12-08 00:30

I have HTML code like this :



         


        
5条回答
  •  遥遥无期
    2020-12-08 01:03

    I think by combining .children() with $(this) will return the children of the selected item only

    consider the following:

    $("div li").click(function() {
    $(this).children().css('background','red');
    });
    

    this will change the background of the clicked li only

提交回复
热议问题