dimanche 3 juin 2018

Setting the "checked" property doesn't check checkbox [pure javascript] [duplicate]

I'm trying a simple code where I set checkBoxElement.checked=true;, but it doesn't make the checkboxes appear as checked.

What is going on?

#these classes are for my own purposes, and I've checked they exist and the elements are returned
checkBosClass = 'feature-enabled-checkbox';
key = 'some_type_of_box';

#getting the elements and setting "checked"
document.getElementsByClassName(checkBoxClass + " " + key).checked = true;




Aucun commentaire:

Enregistrer un commentaire