What is the most efficient way of showing/hiding form fields based on the value of a select control? I have one select control and three input fields, which show/hide based
Put these functions in your $.ready(function(){});
$('#soletrader').hide();
$('#publicsector').hide();
$('#charity').hide();
$('#business-type').change(function(){
var value = $(this).val();
if(value == '1'){
$('#soletrader').show();
$('#publicsector').hide();
$('#charity').hide();
} else if(value == '3'){
$('#soletrader').hide();
$('#publicsector').show();
$('#charity').hide();
} else if(value == '5'){
$('#soletrader').hide();
$('#publicsector').hide();
$('#charity').show();
} else {
$('#soletrader').hide();
$('#publicsector').hide();
$('#charity').hide();
}
});