<script type="text/javascript"> $(document).ready(function() { $(".image-selector").on("click", function(event){ var colvalue = $(this).parent().parent().find("td").first().text(); alert(colvalue); }); }); </script>
if you want it to be based on a TD click, not a click on an image, move the class to td instead of the image
HOWEVER is what I consider a cleaner alternative using HTML5 data attributes
HTML
<td>1</td> <td>John Foster 1</td> <td><div data-value='1' class='image-selector'><img src='imagens/grid_cancel.png' title='' /></div></td>
JQuery
<script type="text/javascript"> $(document).ready(function() { $(".image-selector").on("click", function(event){ var colvalue = $(this).data('value'); alert(colvalue); }); }); </script>
source share