Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Jquery exclude first td on click event?

How to exclude the first td on the click event of jquery that I created below? I want to exclude the all first td of the rows on the click event that produces dialog box.

jQuery("#list tbody tr").click(function(){

//some code here

});

<table>
    <tr>
        <td>first</td>
        <td></td>
        <td></td>
    </tr>
    <tr>
        <td>first</td>
        <td></td>
        <td></td>
    </tr>
</table>
like image 894
spicykimchi Avatar asked Jan 13 '12 03:01

spicykimchi


1 Answers

How about using the first-child selector combined with :not:

jQuery("#list tbody tr td:not(:first-child)").click(function(){
    //some code here
});

Example: http://jsfiddle.net/Rq8Xf/

like image 67
Andrew Whitaker Avatar answered Sep 16 '22 15:09

Andrew Whitaker