I would like to create simple drop down with options and one of the will be PASS then show DIV once selected option PASS from drop down menu, for other options DIV will be closed
<script type="text/javascript">
document.getElementById('mfi_4_a_i').onchange = function(){
if (this.value == 'PASS') {
document.getElementById('sdd').style.display = "block";
} else {
document.getELementById('sdd').style.display = "none";
}
};
</script>
<select id="test" name="test" onChange="changetextbox();">
<option value="PASS">PASS</option>
<option>No</option>
<option>No, but planning in future</option>
</select>
<input type="text" name="test" id="sdd" />
Change the order
You need to ensure that when the JavaScript runs the DOM elements are ready ….
Note your
idattributes do not match either ..mfi_4_a_iin JavaScript vstestin HTML and you should either write a functionchangetextboxor writegetElementById('blah').onchange = function() {not both …Working example here
Another Note you had
this should be
I changed the case of the
Lin Element