jQuery - add onclick to TR

Posted by Guus on Stack Overflow See other posts from Stack Overflow or by Guus
Published on 2011-01-06T12:49:27Z Indexed on 2011/01/06 12:54 UTC
Read the original article Hit count: 159

Filed under:

I use Richfaces and one of the rich:dataTable generates this html:

<form id="scheduleForm">
  <table id="scheduleForm:rowList">
    <tr>
      <td></td>
    </tr>
  </table>
</form>

I want to act on a click on a TR for this table. How can I do this? The following also works for other tables on the page and I get the alert() for the other rows as well, and I don't want that.

        jQuery('#scheduleForm:rowList tr').click(function(event) {
            alert(1);
        });

© Stack Overflow or respective owner

Related posts about jQuery