Skip to content

Instantly share code, notes, and snippets.

@thedamon
Created June 8, 2012 19:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save thedamon/2897686 to your computer and use it in GitHub Desktop.
Save thedamon/2897686 to your computer and use it in GitHub Desktop.
Toggles an input after any <select> item with a value of 'other' is chosen
if($("select").length) {
$("select").live("change", function(){
$(this).next(".other").remove();
if($(this).val() == "Other") {
$(this).after('<input name="'+$(this).attr('name')+'[other]" class="other">');
}
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment