Skip to content

Instantly share code, notes, and snippets.

@charmoniumQ
Created October 4, 2013 22:39
Show Gist options
  • Save charmoniumQ/6834019 to your computer and use it in GitHub Desktop.
Save charmoniumQ/6834019 to your computer and use it in GitHub Desktop.
Dropdown where you can select a pre-existing option, or "other" and create your own
<select onchange="checkvalue(this.value)">
<option value='Bailey'>Bailey</option>
<option value='Bedichek'>Bedichek</option>
<option value='Burnet'>Burnet</option>
<option selected value="Other">Other</option>
</select>
<input type="text" name="current_school_other" id="other_current_school" class="pad" style='visibility:visible;' disabled/>
<script>
function checkvalue(val) {
if(val == "Other") {
document.getElementById("other_current_school").style.visibility='visible';
} else {
document.getElementById("other_current_school").style.visibility='hidden';
}
}
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment