FrontendDeveloper.in

JavaScript question detail

How do you get the status of a checkbox

You can apply the checked property on the selected checkbox in the DOM. If the value is true it means the checkbox is checked, otherwise it is unchecked. For example, the below HTML checkbox element can be access using javascript as below:

<input type="checkbox" id="checkboxname" value="Agree" />
Agree the conditions

console.log(document.getElementById(‘checkboxname’).checked); // true or false
Back to all JavaScript questions
Get LinkedIn Premium at Rs 399