e.g.
<div class="myclass" id="div_1"></div>
<div class="myclass" id="div_2"></div>
<div class="notmyclass" id="div_3"></div>
I’d like to end up with array something like [“div_1″,”div_2”]
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.
After selecting
$(".myclass"), you can use the.map()method [docs] to take the.idof each element. This will return a jQuery array-like object containing the ids.Add
.toArray()[docs] to the end if you need a real array.