Created
June 1, 2015 15:49
-
-
Save cwlsn/9404b61ef4396e9bc664 to your computer and use it in GitHub Desktop.
Have 3+ radio buttons that correspond to additional infomation/form elements. The value of each radio button corresponds to a div in the #grounds_more div. This hides all visible divs, then shows the desired one. Toggle doesn't cut it for 3+ items.
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
$("input[name='grounds']:radio").change( function () { | |
var val, obj; | |
val = $(this).val(); | |
obj = $('#' + val); | |
$("#grounds_more > div:visible").fadeOut(300, function () { | |
obj.fadeIn(300); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment