0
General question on web development
How can I confirm whether any HTML radio button in form has been checked using JavaScript DOM.please help
3 Réponses
+ 7
That's not general at all!
+ 4
var form = document.querySelector("form")
var radios = form.elements["rad"] // radio buttons with name attribute "rad"
radios.forEach(function(radio, i){
if(radio.checked) console.log ("radio " + i + " is checked");
});
+ 2
@Ahri 😅😅😅