Dear, I want to comment that I have a list of html elements generated by a loop (while) from PHP (all have the same ID and CLASS). The problem I have is that I want to assign a click event from jquery to those elements. Through the ID, it clearly does not work according to the technical specifications of JQUERY since the DOM the ID must be unique; using CLASS it works but calls the event to all the elements at the same time, even if you click only one (since all of them comapte the same class). So I am involved in this problem, if someone has a contribution to give me, I appreciate it from now on. step to leave the jquery code:
document.querySelectorAll(".elemento")
$("#comentar").click(function(){
$(".elemento").show();
});
Here is a summary of the code I use in the loop:
<?php while($ver=mysqli_fetch_row($result)){ ?>
<div id="hola" class="mundo"><?php echo ver[0];?></div>
<?}>
Salu2 !!!!