Source Code:
(back to article)
Submit
Result:
Report an issue
<!DOCTYPE html> <html> <head> <title>Title of the Document</title> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js"></script> </head> <body> <input type="checkbox" id="checkbox" checked="checked" /> <div id="mydiv"> <input type="checkbox" id="Uncheckbox" /> </div> <script> $("#checkbox").attr("checked") ? alert("Checked") : alert("Unchecked"); $("#Uncheckbox").attr("checked") ? alert("Checked") : alert("Unchecked"); </script> </body> </html>