JSFiddle - React, Tailwind, and code Playground
JavaScript
function add_item(id,val,_obj) {
tmp=document.createElement("OPTION");
tmp.value=id;
tmp.text=val;
_obj.options.add(tmp);
}
function city_change(field) {
if (field.selectedIndex==0) {
while ({%id28}.options.length>0) {%id28}.remove(0);
add_item(0,'-- Please select --',{%id28});
add_item(1,'Bulgaria- tour 1',{%id28});
add_item(2,'Bulgaria- tour 2',{%id28});
add_item(3,'Bulgaria- tour 3',{%id28});
} else
if (field.selectedIndex==1) {
while ({%id28}.options.length>0) {%id28}.remove(0);
add_item(0,'-- Please select --',{%id28});
add_item(1,'Spain- tour 1',{%id28});
add_item(2,'Spain- tour 2',{%id28});
add_item(3,'Spain- tour 3',{%id28});
add_item(4,'Spain- tour 4',{%id28});
} else
if (field.selectedIndex==2) {
while ({%id28}.options.length>0) {%id28}.remove(0);
add_item(0,'-- Please select --',{%id28});
add_item(1,'Turkey- tour 1',{%id28});
add_item(2,'Turkey- tour 2',{%id28});
} else
if (field.selectedIndex==3) {
while ({%id28}.options.length>0) {%id28}.remove(0);
add_item(0,'-- Please select --',{%id28});
add_item(1,'France- tour 1',{%id28});
add_item(2,'France- tour 2',{%id28});
add_item(3,'France- tour 3',{%id28});
add_item(4,'France- tour 4',{%id28});
add_item(5,'France- tour 5',{%id28});
} else
if (field.selectedIndex==4) {
while ({%id28}.options.length>0) {%id28}.remove(0);
add_item(0,'-- Please select --',{%id28});
add_item(1,'Russia- tour 1',{%id28});
add_item(2,'Russia- tour 2',{%id28});
{%id31}.value='400';
} else {
while ({%id28}.options.length>0) {%id28}.remove(0);
add_item(0,'-- Please select --',{%id28});
{%id31}.value='';
}
}