Last active
December 2, 2015 21:19
-
-
Save Zillionx/1251106324abbc69f189 to your computer and use it in GitHub Desktop.
Show Div when selectedIndex Property != 0
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!doctype html> | |
<!-- http://www.w3schools.com/jsref/prop_select_selectedindex.asp --> | |
<html> | |
<head> | |
<meta charset="UTF-8"> | |
<title>tst</title> | |
<script type="text/javascript"> | |
function ShowDiv() { | |
if (document.getElementById('Country').selectedIndex != 0 ) { | |
document.getElementById('Show').style.display = 'block'; | |
} | |
else document.getElementById('Show').style.display = 'none'; | |
} | |
</script> | |
</head> | |
<body> | |
<select onchange="javascript:ShowDiv();" name="Country" id="Country"> | |
<option selected="selected">select country</option> | |
<option>italy</option> | |
<option>uk</option> | |
<option>us</option> | |
</select> | |
<div id="Show" style="display:none"> | |
<p>Show div</p> | |
</div> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment