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

How to access named pipes using JavaScript in Firefox add-on? -

multithreading - OPAL (Open Phone Abstraction Library) Transport not terminated when reattaching thread? -

node.js - req param returns an empty array -