I have multiple divs in my page as:
<div imageId='image5' name='5' class='speechBubble'>
<div imageId='image5' name='5' class='speechBubble'>
<div imageId='image6' name='6' class='speechBubble'>
...
With jquery, I want to loop these divs for the given userId. I need to say loop divs that have class ‘speechBubble’ and name n (5,6)
Thank you
You could use the
.filter()and.each()functions:If you want to match against a userId variable you don’t need the filter function. You could do this: