I am a jQuery noob and seems I always will be, been trying to get this simple thing to work.
What I want is, when the checkbox is checked, hide the div with display: none;.
Here’s a jFiddle example of what I’m making a mess of.
Thanks for any help, or other solutions 🙂
I agree with karim if you just need to hide/show, use
.toggle(bool), if your example is simplified and you need a class, use.toggleClass("class", bool), like this:You can test it out here, the last
.change()call is to make the state match when the page first loads, here’s what I mean.