*head smack* I missed that version of the function. It's definitely
not something I've used.

Karl Rudd

On Thu, Apr 3, 2008 at 1:47 PM, Karl Swedberg <[EMAIL PROTECTED]> wrote:
>
>  Actually, .toggle() is a little like .load() in that it can be used for two
> different things. There is the .toggle() effect and the .toggle(fn, fn)
> event, with the .toggle(fn, fn) doing an "every other" event thing.
>
>
>  http://docs.jquery.com/Effects/toggle
>  http://docs.jquery.com/Events/toggle#fnfn
>
>  Still, Bruce's $(this).attr('checked', true) part doesn't make much sense
> because clicking a checkbox will check/uncheck it by default. Setting the
> checked attribute only seems to make sense when it's being triggered by some
> other element. Or maybe I'm missing something.
>
>
>  --Karl
>  _________________
>  Karl Swedberg
>  www.englishrules.com
>  www.learningjquery.com
>
>
>
>
>
>  On Apr 2, 2008, at 10:23 PM, Karl Rudd wrote:
>
>
> >
> > The "toggle()" function is used to hide and show items, nothing to do
> > with clicking or changing of state.
> >
> > http://docs.jquery.com/Effects/toggle
> >
> > What you want is something like:
> >
> > $('[EMAIL PROTECTED]').click(
> >   function() {
> >     if ( this.checked )
> >
> $(this).parents('tr').animate({backgroundColor:'#9C3'},2000).animate({backgroundColor:'#FFF'},1000);
> >     else
> >
> $(this).parents('tr').animate({backgroundColor:'#9C3'},2000).animate({backgroundColor:'#E0F88F'},1000);
> >   }
> > );
> >
> > Karl Rudd
> >
> > On Thu, Apr 3, 2008 at 12:41 PM, Bruce MacKay <[EMAIL PROTECTED]>
> wrote:
> >
> > >
> > > Hello folks,
> > >
> > > I have a table of data, with each row containing a checkbox.  What I
> want
> > > users to be able to do is tick the box of each row of data they want to
> > > delete (and after ticking, they will submit the form etc etc.
> > >
> > > As a visual aid, I want to alter the background colour of the row - and
> if
> > > they untick a selection, to reverse that background colour change.
> > >
> > > My code as follows achieves the background colour toggle, but the
> > > checkboxes are neither checked or unchecked.
> > >
> > > I'd appreciate someone pointing out my error?
> > >
> > >
> > > $('[EMAIL PROTECTED]').toggle(
> > >    function() {
> > >      $(this).attr('checked',true);
> > >
> > >
> $(this).parents('tr').animate({backgroundColor:'#9C3'},2000).animate({backgroundColor:'#FFF'},1000);
> > >    },
> > >    function() {
> > >      $(this).attr('checked',false);
> > >
> > >
> $(this).parents('tr').animate({backgroundColor:'#9C3'},2000).animate({backgroundColor:'#E0F88F'},1000);
> > >    }
> > > );
> > >
> > > Thanks
> > > Bruce
> > >
> >
>
>

Reply via email to