handling links in a generated list
Extremely remedial question here - apologies - JQuery newcomer here. I'm trying to move some old Javascript code to JQuery, and I'm having trouble determining a best-practice solution.
I think I can best illustrate my problem this way: I have a series of automatically generated div elements, each of which has a delete button which, when clicked, calls a Javascript function to remove it from the list. It employs an outmoded style for using an href to execute the delete function, as per the following example:
-
<div>Div element 1
<a href="javascript:deleteFunction(1)"><img value="deleteButton.gif"></a>
</div>
<div>Div element 2
<a href="javascript:deleteFunction(2)"><img value="deleteButton.gif"></a>
</div>
Can some advise as to the best-practice JQuery style for rewriting the links in the example?
Thanks,
RS