I have code which has a drop down list. And when a certain option of the drop-down list is selected, its assigned DIV is shown with the other div’s hidden. If another option is selected, then the existing DIV is hidden and its assigned div is shown.
But, the div’s being shown/hidden isn’t working properly.
Firebug reports the following (arrow points to the ‘$’):
missing ( before switch expression
[Break On This Error]
switch $(this).val(){
Below is the jQuery code:
$('#ddlOptions').change(function(){
$('div.Results').hide();
switch $(this).val(){
case '1': $('#divResults1').show();break;
case '2': $('#divResults2').show();break;
case '3': $('#divResults3').show();break;
}
});
Because it should be:
switch ($(this).val())instead ofswitch $(this).val()