InterviewHubPRO
Section Overview
Q338

Question 338 of 521

Part 6: Async Internals, Memory, Microtasks & Web APIs (329 - 403)

65%
JavaScript Internals (521 Qs)•Part 6: Async Internals, Memory, Microtasks & Web APIs (329 - 403)

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:

html
  <input type="checkbox" id="checkboxname" value="Agree" />
  Agree the conditions
  <br />
javascript
  console.log(document.getElementById(‘checkboxname’).checked); // true or false