Good Day.
I'm looking for switch
replacement in jQuery. Basically, I have no idea how to replace switch
.
I got following switch
, for about 70 countries. Is there any way to replace it with a loop
?
$("#country").change(function () {
switch ($('#country :selected').val()) {
case 'pl':
$("fieldset#state").hide().load('pl.txt').fadeIn(800);
break;
}
});
Also, is there any possibility to implement loading specific file automatically if there's already selected item?
Edit:
My description of the problem was not the best. Sorry for that. The main problem is:
- I have lists only for some countries, not for all of them
- I was using
switch
for country to read file, if there was no, I was inserting text field by default - I also need to implement loading file by default. What do I mean? I query database for country and then I'm selecting it on country drop down list. How to load file automatically (if any)?
Regards, Tom