I have a set of links:
<div id="parent">
<a id="UserFirst" href="#"></a>
<a id="UserSecond" href="#"></a>
<a id="UserThird" href="#"></a>
</div>
I need a quick way of getting (for example) all the a
children of #parent
, whose ID contains the letter i
.
How can I do it?
Use jquery contains selector
:
$("#parent").find("a[id*='i']").each(function(){
//do something here
});
DEMO FIDDLE
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With