[jQuery] checkbox manipulation and toggle()
Hello...
short version: how do I exclude an element in my selector expression?
long version:
you know those checkboxes in windows where you can actuyally click the
label to check the box?
I'm recreating this with a toggle() like this:
<DIV id="CheckContainer"><INPUT type="checkbox" id="Check"/> Click
here</div>
$("#CheckContainer").toggle(
function(){ $('#Check')[0].checked=true;},
function(){ $('#Check')[0].checked=false;}
);
All fine and dandy as you click the DIV to toggle the checkbox. But
try to click the checkbox itself and the darn thing won't work.
I think the solution is in using the right sleector, like some kind
of :not or !:input or something ???
Ii DON"T want to have to add a span element around the label to assign
the click to, I'd like to just exclude the checkbox.