jQuery: How to get to a particular child of a parent?

后端 未结 5 401
迷失自我
迷失自我 2020-12-04 09:23

To give a simplified example, I\'ve got the following block repeated on the page lots of times (it\'s dynamically generated):

&l
5条回答
  •  刺人心
    刺人心 (楼主)
    2020-12-04 10:22

    You could use .each() with .children() and a selector within the parenthesis:

    //Grab Each Instance of Box.
    $(".box").each(function(i){
    
        //For Each Instance, grab a child called .something1. Fade It Out.
        $(this).children(".something1").fadeOut();
    });
    

提交回复
热议问题