My problem is I am trying to show what is entered into the form right below the form, and for some reason, my radio button comes back as undefined.
I tried putting an id in the radio button itself but that didn't turn out well. It just says the first in the list of radio buttons then. Code that I am using:
function myFunction(){
document.getElementById("HideOrShow").innerHTML = " SID: " + document.getElementById('sid').value + "<br>"
+ "First Name: " + document.getElementById('fname').value + "<br>"
+ "Last Name: " + document.getElementById('lname').value + "<br>"
+ "Major: " + document.getElementById('Major').value + "<br>"
+ "Advisor: " + document.getElementById('advisor').value + "<br>"
+ "New Student?: " + document.getElementById('checkbox').value + "<br>"
+ "Enrollment Date: " + document.getElementById('date').value;
}
<fieldset>
<legend id="advisor">Advisor </legend>
<input type="radio" name="Advisor" value="Chris_McCarthy">Chris McCarthy<br>
<input type="radio" name="Advisor" value="Karen_Smith">Karen Smith<br>
</fieldset>
I need it to show the advisor's name that was chosen