mercredi 22 avril 2020

How to know if a checkbox is checked onmouseover corresponding label

I want to perform certain actions when hovering over checkbox-labels, but only when the checkboxes are checked.
How can I retrieve that information?

HTML

<input clrcheckbox="" type="checkbox" id="checks">
<label for="checks">Check</label>

JS

document.querySelector('label').onmouseover = () => {
    //so here should be something like:
    //if(checkbox is checked) {console.log('checked')}
    console.log('over');
}



Aucun commentaire:

Enregistrer un commentaire