It looks very simple, but I have little experience with jQuery, and I cannot wrap it around.
Say I have a dynamically generated HTML table and there is a link in each row of this table:
<a id='edit'>Edit User</a>
Now the link should call a function with each user ID as a parameter. I could do this inline liek:
<a id='edit' onClick='editUser(<?php echo $row['id']; ?>)'>Edit User</a>
But how to do it in jQuery?
I can call the function as follows:
$('a#edit').click(function () { editUser() return false; });
But how to pass the identifier of this function? I know that I can first insert it into a hidden field and then get it from there using the id of the element, but of course, the best way?
I understand that all links have the same identifier in this way, so should I dynamically create link identifiers by adding user id? But what can I call jQuery?
source share