And yet, another way using jQuery-1.2.6.  Like Dave Methvin said,
there is prolly many ways to do it...

var checkIt = function(){
     if ($(this).siblings().children().filter(":checkbox").attr
("checked")==false) {
        $(this).siblings().children().filter(":checkbox").attr
("checked","checked");
        }
     else if ($(this).siblings().children().filter(":checkbox").attr
("checked")==true){
        $(this).siblings().children().filter(":checkbox").removeAttr
("checked");
        }
};

$("td").bind("click", checkIt);

Hope that helps,
Manowar721

On Jan 31, 4:10 pm, Slafs <slaf...@gmail.com> wrote:
> 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