Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
jQuery Add Other input box to select dropdown
<script>
// Use jquery .change() to bind change event of an element
// Give your form ID of #form
// Add your select with option of 'Other' and add input with class of .inputvis with initial CSS display of none
jQuery( document ).ready(function($) {
var Select = '#form select';
$(Select).change(function(){
if($('Select option:selected').text() == "Other"){
$('.inputvis').show();
}
else{
$('.inputvis').hide();
}
});
});
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.