jQuery: manipulating through children to check the checkbox in a table row

Posted by gsquare567 on Stack Overflow See other posts from Stack Overflow or by gsquare567
Published on 2010-06-07T17:31:48Z Indexed on 2010/06/07 17:42 UTC
Read the original article Hit count: 166

Filed under:
|
|
$("tr.clickable").each(function() {$(this).click(function() {
            $(this).children("td:first > input").is(":checked") ?
                    $(this).children("td:first > input").removeAttr("checked") :
                    $(this).children("td:first > input").attr("checked","checked");
        })});

this only checks the first row in my table (no matter which row i click on). how can i apply it so that it checks the input on the specific row i click on? thanks!

HTML:

<tr id="row0" class="alternate clickable">
    <td><img width="11" height="11" title="This email failed to send." alt="Failed" src="images/error_warning.png"><br>

        <input type="checkbox" value="6751" name="emailCheck[]" class="emailCheck">
    </td>...

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about table