+ 3
How to take input of radio button with only using javascript?
not a form validation, without a form tag. can anybody help me in this?
1 Answer
+ 1
var radio = document.getElementsByClassName("radio");
Return the value of radio button
radio.value
if radio is checked
radio.checked
For multiple radio buttons
for(var a = 0; a < radio.length; a++) {
if(radio[a].checked) {
console.log(radio[a].value);
return;
}
}