thanks Dave and Ricardo!
On Dec 18, 12:00 am, Ricardo Tomasi wrote:
> var $check = $(':checkbox');
> $check.change(function(){
> $('#special')[ $check.attr('checked') ? 'show' : 'hide' ]('slow');
>
> });
>
> that's essentially the same as
>
> $check.attr('checked') ? $('special').show('slow') : $('special').hide
> ('slow');
>
> (which is an if/else). And you don't need the IDs on the inputs.
>
> - ricardo
>
> On Dec 18, 12:58 am, "krozi...@gmail.com" wrote:
>
> > Folks,
>
> > I have two checkboxes. When either one is checked, I would like to
> > show a div. When both are not checked, then I want the div hidden.
> > However, I've only been able to use toggle to show and hide the div
> > only when checking/unchecking one checkbox. It's not quite what I
> > need. So far I have this:
>
> > js:
> > $("#check_1").click(function(){ $("#special").toggle("slow"); });
> > $("#check_2").click(function(){ $("#special").toggle("slow"); });
>
> > html:
> > One
> >
>
> >
> > > Two
>
> >
> > Some special stuff...
> >
>
> > Any help would be appreciated.
>
> > Thanks,
> > Konstantin