javascript - Jquery show div on checkbox -


hello want display div when checkbox checked. thing have multiple selects , want display form until none selected. code not working should because when deselect checkbox div dissapears , should dissapear if none selected.

here js

$('.checkbox').click(function() {     if( $(this).is(':checked')) {         $("#formular").show();     } else {         $("#formular").hide();     } });  

also jsfiddle http://jsfiddle.net/byuak/

try

var $checks = $('.checkbox').click(function () {     $("#formular").toggle($checks.filter(':checked').length>0); }); 

demo: fiddle


Comments

Popular posts from this blog

java - Intellij Synchronizing output directories .. -

git - Initial Commit: "fatal: could not create leading directories of ..." -