I have a group of divs, each containing an anchor tag that triggers a JavaScript function (which uses AJAX to delete a row from a table). Here's an example setup:
<div id="container">
<div><a id="btn" onclick="deleteRow()">Delete</a></div>
<div><a id="btn" onclick="deleteRow()">Delete</a></div>
<div><a id="btn" onclick="deleteRow()">Delete</a></div>
... and so on
</div>
Then I have this jQuery code;
$("#btn").click(function() {
$(this).parent("div").fadeOut();
});
This code should fade out each clicked element, but it's only working for the first one. When I click on the buttons of the other elements, nothing happens.
I'm not very familiar with jQuery, so I'm unsure why this is occurring.