I am using the following html code to display options :
<select class="form-control input-lg" style="text-align:center">
<option value="type">-- Select a Type --</option>
<option value="student">Student</option>
<option value="company">Company</option>
</select>
Now suppose I want to display a list of input boxes within the div tag (as shown below) only if I select the option Student and a separate list of input options for Company based on what the user selects. The following input boxes are for Student option:
<div id="divina">
<input class="form-control input-lg" name="name" placeholder="Full Name" type="text" >
<input class="form-control input-lg" name="usn" placeholder="USN" type="text">
<select class="form-control input-lg" name="branch">
<option value="Month">-- Select branch --</option>
<option value="Month">Computer Science & Engineering</option>
<option value="Month">Information Science & Engineering</option>
<option value="Month">Electronics & Communication Engineering</option>
<option value="Month">Electrical & Electronics Engineering</option>
<option value="Month">Mechanical Engineering</option>
<option value="Month">Civil Engineering</option>
<option value="Month">MBA</option>
<option value="Month">MCA</option>
</select>
<input class="form-control input-lg" name="contact" placeholder="Contact No." type="text">
<input class="form-control input-lg" name="email" placeholder="E-mail" type="email">
<input class="form-control input-lg" name="password" placeholder="Password" type="password">
</div>
I am using the following javascript in the head tag:
JS :
function show(that){
if(that.value=="student"){
document.getElementById("divina").style.display = "block";
}
else{
document.getElementById("divina").style.display = "none";
}
}
Well I have tried a lot, but it does not work at all, any input or suggestions would be appreciated!!!