jquery selector for td in a table

Posted by ooo on Stack Overflow See other posts from Stack Overflow or by ooo
Published on 2010-05-20T16:05:50Z Indexed on 2010/05/20 16:10 UTC
Read the original article Hit count: 142

Filed under:
|

i want to get a event that will fire when i click inside a td of a html table

i had this:

 ('td').live('click', function() {
            alert($(this).attr('id'));
        });

which works but this fires inside the 'th" cells as well (not sure why).

is there any selector that just fires inside td's and not th's. I tried this:

 ('tbody td').live('click', function() {
            alert($(this).attr('id'));
        });

but that didn't seems to stop this firing for the th's.

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about jquery-selectors