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> <div id="checkList"> <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" /> </div> <input type="button" id="btnCheck" value="Check" /> <input type="button" id="btnUnCheck" value="UnCheck" /> <script> $('#btnCheck').on('click', function() { $('input')[0].checked = true; }); $('#btnUnCheck').on('click', function() { $('input')[0].checked = false; }); </script> </body> </html>