jquery - javascript run function if everything is checked, filled, selected -


i have problem javscript. wonder possible create in javascript:

<script> function all_is_filled(){ if($('input[type=checkbox]').checked && document.getelementbyid('text_field').value!="" ) { //do something... }  } </script> 

so when check checkbox , fill text_field something...is there way it?

this work:

function all_is_filled() {      if ($('input[type=checkbox]').prop('checked') == true && $('#text_field').value != "") {         //do something...     } }; $('#myform').on('change', function () {     all_is_filled() }); 

i added listen function call all_is_filled() on change, can put onsubmit.

simple demo here


Comments