Good morning I would like to know how do I clear what was clicked on the radiobutton button, because in the textBox I use the name.Clear (); I would like to know how I can do it on the radio button
Thank you.
Good morning I would like to know how do I clear what was clicked on the radiobutton button, because in the textBox I use the name.Clear (); I would like to know how I can do it on the radio button
Thank you.
Simply change the element attribute from checked
to false
.
In jQuery, you can select by id
or name
, for example:
$('input[name=Choose]').attr('checked',false);
In pure Javascript:
var ele = document.getElementsByName("Choose");
for(var i=0;i<ele.length;i++)
ele[i].checked = false;
Retired from StackOverflow in English in response to NVRAM
To uncheck a specific input just make elemento.checked = false;
.
In case you have several, you have to iterate and do one by one. Something like:
var inputs = document.querySelectorAll('input[type="radio"]');
for (var i = 0, l = inputs.length; i < l; i++){
inputs[i].checked = false;
}
But often what you want is to re-start a form, this can be done with:
document.querySelector('form').reset();