Select row by checkbox

by shubham59

HTML

<script src="http://code.jquery.com/jquery-2.0.3.min.js"></script>
<table>
    <tr>
        <td><input type="checkbox" id="1_1" /></td>
        <td><input type="checkbox" id="1_2" /></td>
        <td><input type="checkbox" id="1_3" /></td>
    </tr>
    <tr>
        <td><input type="checkbox" id="2_1" /></td>
        <td><input type="checkbox" id="2_2" /></td>
        <td><input type="checkbox" id="2_3" /></td>
    </tr>
</table>

JavaScript

$('input:checkbox').click(function (){
    var thisCheck = $(this);
    if (thischeck.is(':checked')){
        thisCheck.parent().children('input:checkbox').attr('checked','checked');
    }
});