I whipped up a demo.
Is this what you meant?

http://www.commadot.com/jquery/checkboxToggle.php

Glen

On 9/27/07, voltron <[EMAIL PROTECTED]> wrote:
>
>
> Hmm, Thanks guys, but maybe  I did dot make myself to clear. I am able
> to check the boxes, but I´m not able to toggle between both states.
> When the user checks the box, an input field is to be disabled, and
> when he unchecks it, the input box should be enabled, thats fwhat the
> toggle function is for, but it causes my browser to freeze when I use
> it like that. Any other ideas?
>
> Thanks!
>
> On Sep 27, 4:46 pm, "Glen Lipka" <[EMAIL PROTECTED]> wrote:
> > $(":checkbox").attr("checked","anyThingWillCheckIt")
> > $(":checkbox").removeAttr("checked")
> >
> > Glen
> >
> > On 9/27/07, Erik Beeson <[EMAIL PROTECTED]> wrote:
> >
> >
> >
> > > To check or uncheck a checkbox, assign true or false to its 'checked'
> > > property (untested): $('#myCheckbox')[0].checked = true; or
> > > $('#myCheckbox').attr('checked', true);
> >
> > > But it looks like you're trying to enable/disable them, in which case
> you
> > > probably want $(...).attr('disabled', 'disabled'); and
> > > $(...).removeAttr('disabled');
> >
> > > --Erik
> >
> > > On 9/27/07, voltron <[EMAIL PROTECTED]> wrote:
> >
> > > > How would one toggle a checkbox?
> >
> > > > This does not work:
> >
> > > > $("#postcode_all").toggle(function(){
> > > >         $("#intended_postcode-0").attr("disabled", "disabled");
> > > >             },function(){
> > > >         $("#intended_postcode-0").attr("enabled", "enabled");
> > > >     });
> >
> > > > Thanks
>
>

Reply via email to