I would suggest a couple of changes

var $checkboxes = $('input[type=checkbox]');
$('a').toggle(function() {
  $checkboxes.attr('checked','checked');
  return false;
}, function() {
  $checkboxes.removeAttr('checked');
  return false;
});

p.s.
do you really need to post a 6K dealerskinslogo.bmp, I'm sure you
didn't mean to post it, but if you are going to have a logo should it
really be a bmp file??

I've not tested but it should work. There's no need to use the .each

On Oct 30, 4:28 pm, "Andy Matthews" <[EMAIL PROTECTED]> wrote:
> I've got some code which I think is pretty simple. But I'd like to see if
> there's a quicker (less code) way to do this. I simply want to be able to
> toggle all checkboxes on a page on/off.
>
> Is there a better way?
>
> var $checkboxes = $('input[type=checkbox]');
>
> $('a').toggle(function(){
>    // toggle me on
>    $checkboxes.each(function(){
>     $(this).attr('checked','checked');
>    });
>    return false;
>   },function(){
>    $checkboxes.each(function(){
>     $(this).removeAttr('checked');
>    });
>   });
>
> ____________________________________
>
> Andy Matthews
> Senior ColdFusion Developer
>
> Office:  877.707.5467 x747
> Direct:  615.627.9747
> Fax:  615.467.6249
> [EMAIL PROTECTED]<http://www.dealerskins.com/>
>
>  dealerskinslogo.bmp
> 6KDownload

Reply via email to