i have a strange behaviour with a
and with img
tag inside.
I have a php page with a table that is a list of records. At the end of every ro
You're using an ID selector #delete a
which will only match one (generally the first) element.
Try using a class, e.g. .delete a
.
The reason you only get one element is because JQuery optimizes any selector that begins with #
passes through to document.getElementById
, which only returns 1 element.
Here's an example of how to use event delegation to achieve the same thing:
$("#tableid").click(".delete a", function(e) {
// your code
});
Your html would need to have an ID on your table and give class="delete"
to the container of your delete links.