Skip to content

Instantly share code, notes, and snippets.

@huy-tran
Created March 24, 2016 04:39
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 huy-tran/4e12353c2ed27f59f215 to your computer and use it in GitHub Desktop.
Save huy-tran/4e12353c2ed27f59f215 to your computer and use it in GitHub Desktop.
jQuery Toggle Selection
var $formChoice = $('.gh-form-choice');
$('#typesOfStudy').on('change', function () {
var value = $(this).val();
if (value !== '') {
var formToShown = '.gh-form-' + value;
$formChoice.not(formToShown).slideUp(400, function () {
$(formToShown).slideDown();
});
} else {
$formChoice.slideUp();
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment