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

30th Jun 2017, 7:21 AM
EVANS KIPTARUS KIBET
EVANS KIPTARUS KIBET - avatar
3 Respostas
+ 7
That's not general at all!
30th Jun 2017, 9:47 AM
Ahri Fox
Ahri Fox - avatar
+ 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"); });
30th Jun 2017, 7:41 AM
Calviղ
Calviղ - avatar
+ 2
@Ahri 😅😅😅
30th Jun 2017, 10:26 AM
Calviղ
Calviղ - avatar