I need to obtain all the divs with a given id but the jquery each function only obtain the first one.
Example:
<div id="#historial">some html code</div>
<div id="#historial">some html code</div>
<div id="#historial">some html code</div>
<div id="#historial">some html code</div>
script:
$("#historial").each(function() {
alert("one div");
});
if I pass a anchor o a id + anchor ej $("#lala a") it's works ok.
What's wrong?
BR
You can only use a specific id for one element in a page. Use a class instead:
<div class="historial">some html code</div>
<div class="historial">some html code</div>
<div class="historial">some html code</div>
<div class="historial">some html code</div>
$(".historial").each(function(e) {
alert("one div");
});
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