jquery - Toggle div based on checkbox value -


i'm not sure how accomplish this. want hide div based on checkbox value. code toggle.

appreciate help

.always checkbox

$(document).ready(function () {             $('.always').click(function () {                                 $('#dates').toggle();             });         }); 

.toggle() takes boolean well, this:

$(function () {   $('.always').change(function () {                      $('#dates').toggle(!this.checked);   }).change(); //ensure visible state matches }); 

you can test out here. assume in above want #dates hidden if .always checked, that's it'll do.


Comments

Popular posts from this blog

asp.net - repeatedly call AddImageUrl(url) to assemble pdf document -

java - Android recognize cell phone with keyboard or not? -

iphone - How would you achieve a LED Scrolling effect? -