(Also replicated in JSfiddle)
Given an HTML checkbox:
<input type="checkbox">
The checkbox is displayed with no tick:
Logging the value of the element:
console.log(document.querySelector('input').value)
Logs on
, even though the checkbox is unchecked.
Why is the value of the checkbox 'on', when the checkbox is unchecked?
How can I get the correct value?
Aucun commentaire:
Enregistrer un commentaire