Source Code:
(back to article)
Submit
Result:
Report an issue
<!DOCTYPE html> <html> <head> <title>Title of the document</title> </head> <body> <form> <p><input type="checkbox" id="checkId"> Are you sure?</p> <button type="button" class="check" onclick="check()">Yes</button> <button type="button" class="uncheck" onclick="uncheck()">No</button> </form> <script> //create check function function check() { let inputs = document.getElementById('checkId'); inputs.checked = true; } //create uncheck function function uncheck() { let inputs = document.getElementById('checkId'); inputs.checked = false; } window.onload = function() { window.addEventListener('load', check, false); } </script> </body> </html>