Source Code:
(back to article)
Submit
Result:
Report an issue
<!DOCTYPE html> <html> <head> <title>Title of the Document</title> <script src="https://code.jquery.com/jquery-3.5.0.min.js"></script> </head> <body> <input id="checkbox1" type="checkbox" name="one" value="1"> <input id="checkbox2" type="checkbox" name="two" value="2"> <input id="checkbox3" type="checkbox" name="thr" value="3"> <script> $(document).ready(function() { $('input[type="checkbox"]').click(function() { if($(this).prop("checked") == true) { alert("Checkbox is checked."); } else if($(this).prop("checked") == false) { alert("Checkbox is unchecked."); } }); }); </script> </body> </html>