+ 1

How do I check whether a checkbox is checked in jQuery?

20th Oct 2020, 1:21 PM
D.Vetrivel
D.Vetrivel - avatar
2 Answers
20th Oct 2020, 1:36 PM
Ayush Kumar
Ayush Kumar - avatar
0
You can use the jQuery prop() method to check or uncheck a checkbox dynamically such as on click of button or an hyperlink etc. $("#radio1").prop("checked", true); To check the current state of the checkbox you must instead use the jQuery checked property . It is dynamically updated as the user checks/unchecks. if(document.getElementById('radio1').checked) { alert("Checked"); } http://net-informations.com/jq/iq/checked.htm
17th May 2021, 6:04 AM
linehammer