Checkbox if else Condition in Jquery - fabulouscode

Tuesday, October 22, 2019

Checkbox if else Condition in Jquery



HTML
=======
<input class="checkbox_check" id="chkfullorderid" type="checkbox" autocomplete="off">


Checked Condition

$('#chkfullorderid').prop('checked') == true){
alert('Check');
}

OR
if ($('input.checkbox_check').is(':checked')) 
 { 
 alert('Check'); 
 }
Click Event  a check
  <label>
      <input class="checkhour" type="checkbox">One</label>
    <label>
var clicked = false;
$(".checkall").on("click", function() {
  $(".checkhour").prop("checked", !clicked);
  clicked = !clicked;
});
Unchecked Condition

$('#chkfullorderid').prop('checked') == false){
alert('Check');
}

OR

if ($('#chkfullorderid').not(':checked').length) {
                  alert('unchecked');
           }

All Checkbox unchecked

 $('input:checkbox').removeAttr('checked');


No comments:

Post a Comment

I am Safiqul Islam Tuhin