Created
June 8, 2012 19:21
-
-
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
This file contains 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
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