Hi I will try to give only the needed information I have a div container with 3 radiobuttons. ids "rad1", "rad2", "rad3" I have 2 textfields in a form with ids "textField1" , "textField2".
I want to show different textFields depending on which radio button is clicked.
if ("rad1" is clicked) I want to show "textField1"
if ("rad2" is clicked) I want to show "textField2"
if (rad3 is clicked/nothing is clicked) I want to hide both.
This is my JavaScript that I though would work but does not.
fieldShower();
function fieldShower() {
if (document.getElementById('rad1').checked) {
document.getElementById('textField1').style.display = 'block';
document.getElementById('textField2').style.display = 'none';
} else if(document.getElementById('rad2').checked) {
document.getElementById('textField1').style.display = 'none';
document.getElementById('textField2').style.display = 'block';
} else {
//hide both
document.getElementById('textField1').style.display = 'none';
document.getElementById('textField2').style.display = 'none';
}
}