how to loop over the child divs of a div and get the ids of the child divs?

后端 未结 6 1684
你的背包
你的背包 2020-12-16 12:20

I have a div with id test

and through the foreach loop I am creating some inner divs inside the test div. So it becomes like this.

6条回答
  •  遥遥无期
    2020-12-16 13:13

    Use jQuery.

    This code can be addapted to your needs:

    $testDiv = ​$('div#test')​​​​​​​​​​​​.first();    
    $('div', $testDiv).css("margin", '50px');​​​​
    

提交回复
热议问题