Created
November 5, 2013 07:22
-
-
Save spencejs/7315154 to your computer and use it in GitHub Desktop.
Show Form Fields Based On Field Value
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
function toggleFields() { | |
$('.additional-field').hide(); | |
var selected = $('#business-type').val(); | |
switch (selected) { | |
case 1: | |
$('#soletrader').show(); | |
break; | |
case 3: | |
$('#publicsector').show(); | |
break; | |
case 5: | |
$('#charity').show(); | |
break; | |
} | |
} | |
toggleFields(); | |
$('#business-type').change(toggleFields); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment