Hi!

I would like to write a js script using jQuery which could help me to
toggle checkbox.
I have one checkbox for each row of table and i would like to simplify
the checking and unchecking the boxes by letting user just to click
anywhere on the row to do this.
I was trying something with children and parent function but it seems
to doesn't work.

table:
<table class="myTable">
  <tr>
    <td>first</td><td>row</td>
    <td><input type="checkbox" name="1" value="1"></td>
  </tr>
 ...
</table>

my jQ code:
 $(document).ready(function(){
    $(".myTable td").click(function(){
                    $(this).parent("tr").children
("input:checkbox").each(function(){
                             this.checked = !this.checked;
                    });
});

any help?
thanks in advance!

Reply via email to