Wednesday, December 2, 2009

[jQuery] Ignoring click events in cells

I have a table, which contains some data aswell as a checkbox:

<tr id="14373">
<td><input type="checkbox"/></td>
<td>...</td>
<td>...</td>
</tr>
Each row contains an id, and I want to call a function based on the
click event:

$("tr").click(function() {
alert($(this).attr("id"));
});

However, checking/unchecking the checkbox in each row also triggers
the event. Is there anyway of preventing this?

No comments: