Javascript examples for jQuery:Form Checkbox
Check checkbox if something is typed in a input type text
<html> <head> <script src="https://code.jquery.com/jquery-1.10.2.min.js"></script> </head> /*from w w w .ja v a2 s .c o m*/ <body> <input type="text" class="num"> <br> <input type="checkbox" name="check" class="check"> <script> $(".num").on("keyup", function(e){ if(this.value!=""){ $(".check").prop("checked", "checked"); }else{ $(".check").prop('checked', ""); } }); </script> </body> </html>