<div class="A1"> <div id="child1">A1-1</div> <div id="child2">A1-2</div> <div id="child3">A1-3</div> <div id="child4">A1-4</div> <div class="A2"> <div id="child5">A2-1</div> <div id="child6">A2-2</div> <div class="A3"> <div id="child7">A3-1</div> <div id="child8">A3-2</div> </div> </div> </div> so this is the code I have, I am looking for a way to get the number that comes after the word "child" in each ID. I was thinking about using something like var values = $(‘id:contains(child)’).attr(); but it doesn't work. or maybe using regex? any suggestions? thank you
.attr()function.