1
I am trying to use a code to get the value of the selected radio button and I am facing the following errors:
Checked property does not exist in type 'Htmlelement'.
The property 'value' does not exist in type Nodelistof<Htmlelement>.
Follows my code :
getRadioValor(name){
var rads = document.getElementsByName(name);
for(var i = 0; i< rads.length; i++){
if(rads[i].checked){
return rads.value;
}
}
}
What is the reason for these errors? And how to solve ?
https://stackoverflow.com/questions/47492595/why-foreach-does-not-exist-on-nodelistof
– Israel Zebulon
I’m sorry, but I couldn’t quite understand what’s causing the error ...
– JV M