how do i get the child divs and put it in a array?
<div id="parent">
<div id="child1"></div>
<div id="child2"></div>
</div>
var array = $('#parent > div').... (im stuck).
thanks!
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Actually there is nothing wrong with your jQuery code. You should wrap it into the
.ready()callback:If you “really” want a a plain
arrayyou need to use.get()For the array of the ID’s, as you mentioned in your comment use:
Ref.: .map(), .get()