How do I target the currently selected radio button with javascript? I do have a script to know which radio is currently selected. How ever, I wanted to do something else after I figured out which is currently selected.
var selectedRadio = document.getElementById('changeDetails').value;
if (selectedRadio == 'options1') {
//do something to radio button with value options1
}
How would I be able to target the currently selected radio if I only have the value of it as an identifier? I'm thinking of something like getElementByValue but of course, that doesn't exist so I'm looking for something that does the same.
No jQuery.