javascript - how can check two variable in the condition? -


$('.supplier').on('click', function(){         var supplier = $('.supplier').is(":checked");         var customer = $('.customer').is(":checked");          // if both unchecked, hide table         if( supplier && customer == false){             alert('hide table');         }         // if supplier checked, show supplier, else hide supplier     }); 

i want hide table if don't check .suppler , .customer

thanks much.

one thing hasn't been addressed in previous answers (great are) you're calling function when click .supplier. i'd imagine want call function when click on either .supplier or .customer. if so, you'll need add .customer selector:

$('.supplier, .customer').on('click', function(){     var supplier = $('.supplier').is(":checked");     var customer = $('.customer').is(":checked");      // if both unchecked, hide table     if( !supplier && !customer){         alert('hide table');     }     // if supplier checked, show supplier, else hide supplier }); 

Comments

Popular posts from this blog

rest - Spring boot: Request method 'PUT' not supported -

java - WrongTypeOfReturnValue exception thrown when unit testing using mockito -

php - Magento - Deleted Base url key -