dimanche 8 février 2015

Uncheck a Radio button in Javascript using the class

Here are my 2 radios buttons :



<input type="radio" name="sex" id="Button1" class="Button"/>

<input type="radio" name="sex" id="Button2" class="Button"/>


When I call a function that countains :



document.getElementById('Button2').checked = false;


It unchecks the Button2. But I want to uncheck it by using the class


And when the function contains :



document.getElementsByClassName('Button').checked = false;


It does not uncheck the Button2


Why and what is the solution ?


Thank you. :)





Aucun commentaire:

Enregistrer un commentaire