How to check if a checkbox has been checked using JQuery?
|
|
|
|
|
Question: How to check if a checkbox has been checked using JQuery? Answer: The following code checks if a checkbox has been checked var checkBox = $("input[name='myCheckBox']:checked").val();
if(checkBox == 'on'){
  alert('CHECKED!!');
}else{
  alert('NOT CHECKED');
} myCheckBox is the name of the checkbox elementÂ
eg. <input type="checkbox" name="myCheckBox" />
|