Is there a way I can generate switch statements in jquery/javascript by using some sort of loop to do the work for me? For example, if I had a statement like:
switch ($("#play option:selected").text()) {
case '1':
$("#play_1").slideDown().find("input").addClass("someClass");
break;
case '2':
$("#play_1").slideDown().find("input").addClass("someClass");
$("#play_2").slideDown().find("input").addClass("someClass");
break;
}
This is fine if I only have a few options in my select menu, but what I had 99 options and therefore by case '99' I had to display 99 new divs or whatever they might be?