pretty new to HTML and I was wondering why this snippet of code doesn’t work?
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
<div style="font-family: Consolas;">
<h1>This is a survey regarding *</h1>
<form name="firstQuestion" method="get" action="">
<input type="radio" name="q1" value="1" id="num1">I think its 1<br>
<input type="radio" name="q1" value="2" id="num2">I think its 2<br>
<input type="radio" name="q1" value="3" id="num3">I think its 3<br>
<input type="radio" name="q1" value="4" id="num4">I think its 4<br>
<input style="position: absolute; bottom: 10px; right: 10px" type="button" value="proceed" onclick="alert('Checked value is: '+getCheckedValue(document.forms['firstQuestion'].elements['q1']))">
</form>
</div>
</body>
The problem is that when I press the proceed button nothing happens whereas it is supposed to return the selected radio button as you can see.
Also now I’m at it, does anyone know how to add for example an extra textfield between option 3 and 4 if possibility 3 is chosen?
by default and if not 3 is chosen the textfield shouldnt be visible.
The button handler is calling a javascript function called
getCheckedValue, but you haven’t defined this.=== UPDATE ===