samedi 6 octobre 2018

How can i check the checkbox with mousedown event?

I have a code

checkbox.addEventListener('mousedown', function(){
    if(!this.checked)
        this.checked = true;
});

It must turn on the checkbox when mouse button is down. And it works perfectly but when i release the button the checkbox turns back off. How can i fix this?




Aucun commentaire:

Enregistrer un commentaire