[jQuery] Adding to the browsers onclick?
I'm trying to replace labels with graphics. They're for check boxes and I need the image background to change and stay changed on click. I have my css all set and a little jQuery toggle() makes it all very easy:
$(".musthave label").toggle(function(){
$(this).addClass("musthavechecked");
},function(){
$(this).removeClass("musthavechecked");
});
the problem is that it's not checking the actual form box! When I remove the above bit of code from my js file, clicking the label toggles my check box, as expected. Here's my html.
<input name="importance" id="importance" type="checkbox" value="required" />
<label for="importance">Must Have</label>
Again, with js off, the label works just fine.
I'm not really sure what's going on but I'm assuming that jQuery is entirely replacing the default browser onClick event for labels but what I really want to do is append the onClick, much like $(doc).ready(). Am I on the right path? Is this possible?
Thanks!
Will
_______________________________________________
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/