given this html code:
<td><img class='del' id='4' src='images/delete.gif'></td>
I am in trouble understanding how to complete the following code:
$(document).ready( function(){ setup(); } ); function setup(){ $('#deleteForm').hide(); $('img.del').bind('click', formDisplay); } function formDisplay(){ $('#deleteForm').show(); }
Here I need to pass to the callback the value of the id attribute of the image element but I have some problem to understand how this or $('this') work in jQuery
Still better, I would like to have html code this way:
<tr id='4'> <td>...</td><td>...</td><td><img class='del' src='images/delete.gif'></td> </tr>
being able to get the value of each of the child of the <tr> element identified by its id from within the callback.
Has someone some advices?
Many thanks
Just re-formatting bendewey’s answer: