I am trying to click a table row and perform an action. However if they click the first <td>
cell I do not want that to perform the action.
Here is the code I have so far:
jQuery('#dyntable tbody tr').live('click', function () {
nTr = jQuery(this)[0];
openMessage(oTable, nTr);
});
This works as intended, except the first <td>
has a check box, so if they click in that cell I do not want to call the openMessage(oTable, nTr);
function.
I also still need nTr
to = the contents of the row.
Use target of click within row, and check the index of TD
Simplified DEMO: http://jsfiddle.net/WLR9E/
live() is deprecated , if using jQuery >= 1.7 convert to on(). Following assumes main table is a permanent asset in page.
This line in your code is redindant, it simply returns the same as
this
You could try adding a class or unique id to that
<td>
element. Then in your handler you test against it.This'll do the trick:
Here's the fiddle to test: DEMO