Sorry Wizzud, but your code didn't works either, the checkbox is
checked every time.

I have also try in different way like this and this make me crazy !:

function myToggle(toggleElem, showHideElem){
        var showHide = $(showHideElem);
        $(toggleElem).toggle(
                function(){ showHide.show('slow');
                        $(toggleElem).attr("checked", "checked");
                        },
                function(){     showHide.hide('slow');
                $(toggleElem).attr("checked", "");}
        );
}

The show("slow") and hide("slow") are running well.
But this let the checkbox checked every time.


Any help will be very appreciated.

Damien


On Nov 3, 1:15 am, Wizzud <[EMAIL PROTECTED]> wrote:
> function myToggle(toggleElem, showHideElem){
>   var showHide = $(showHideElem);
>   $(toggleElem).toggle(
>     function(){ showHide.show('slow'); },
>     function(){ showHide.hide('slow'); } )
>     .each(function(){ this.checked = !this.checked; });
>
> }
>
> On Nov 2, 12:21 pm, Snook <[EMAIL PROTECTED]> wrote:
>
> > > Calling toggle() runs event.preventDefault.
> > > Whatever you want the click to do, you need to code it yourself.
>
> > Ok, thanks.
> > I have tried different implementation of preventDefault, regarding
> > what I have found in this group. And probably I'm completely wrong
> > because no one works for me.
>
> > Here is what I have tried:
>
> > function myToggleShow(toggleElem, showHideElem){
> >           var showHide = $(showHideElem);
> >           $(toggleElem).toggle(
> >             function(e){
> >                 e.eventDefault();
> >                 showHide.show('slow');
> >             },
> >             function(){ showHide.hide('slow'); }
>
> >           );
>
> > }
>
> > myToggleShow('#regime_lstd_c', '#regime_lstd');
>
> > Did I need an other plugin or library ?

Reply via email to