Having trouble removing a selected radio button and its associated label. Struggling to implement the remove function that targets the selected radio button and removes both the button and label.
function removeRadioItem() {
var radios = document.getElementsByName("attr_radio");
for (var i = 0; i < radios.length; i++) {
radio = radios[i];
if (radio.checked) {
radio.parentNode.removeChild(radio);
}
}
}
Check out the JsFiddle link for reference.