How to display CheckBox check uncheck value in JavaScript Alert MessageBox?
<span>Do you have Passport?</span> <input type="checkbox" id="chkConfirm" />
Example: Yes, No
Hi makenzi.exc,
Use the click event handler to check the CheckBox checked or not using the checked property.
Refer below example.
HTML
<html> <head> <meta charset="utf-8" /> <title></title> <style type="text/css"> body { font-family: Arial; font-size: 10pt; } </style> </head> <body> <span>Do you have Passport?</span> <input type="checkbox" id="chkConfirm" onclick="ShowMessage()" /> <script type="text/javascript"> function ShowMessage() { var checkBox = document.getElementById("chkConfirm"); alert(checkBox.checked ? "Yes" : "No"); }; </script> </body> </html>
Demo
Screenshot
Downloads
Download Sample
© COPYRIGHT 2025 ASPSnippets.com ALL RIGHTS RESERVED.