Change 3 Dropdown Values Through Javascript
i am using below script, need to change the value of 3 dropdown on the basis of first two, Currently it showing the same value to if i am changing the values in first dropdown. Her
Solution 1:
Here is a function that you can use as an onchange
event:
HTML (notice the onchange event):
<select name="sp" id="sp"class="servicecategory" onChange="change_select_values(this.value)">
JS:
function change_select_values(val){
varsel= document.getElementById('Word_Count');
switch(val){
case"Medical and Biomedical Manuscript Rewriting":
sel.options.length = 0; // clear select options
sel.options[0] = newOption('TEXT', 'VALUE');
sel.options[1] = newOption('TEXT', 'VALUE');
sel.options[2] = newOption('TEXT', 'VALUE');
sel.options[3] = newOption('TEXT', 'VALUE');
break;
default:
sel.options.length = 0;
sel.options[0] = newOption('1 - 1000 words', 'Lessthan1000');
sel.options[1] = newOption('1001 - 2000 words', 'Lessthan2000');
sel.options[2] = newOption('2001 - 4000 words', 'Lessthan4000');
sel.options[3] = newOption('4001 - 6000 words', 'Lessthan6000');
}
changeprice(sel.options[0].value); // change input value
}
Post a Comment for "Change 3 Dropdown Values Through Javascript"