Friday, 1 March 2013

checkbox is not checked – jQuery

How do you know when a form checkbox is not checked? is(:checked) We’ll use the  jQuery  selectors like this: < script > function  my_... thumbnail 1 summary

How do you know when a form checkbox is not checked?

is(:checked)

We’ll use the jQuery selectors like this:
<script>
function my_function(){

   if(! $('#my_checkbox').is(':checked')){
                
    alert("Please check it!");

  }else{

      // submit the form
      $('#my_form').submit(); 

  }

}
</script>

No comments

Post a Comment