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){
    var sel = document.getElementById('Word_Count');
    switch(val){
        case "Medical and Biomedical Manuscript Rewriting":
            sel.options.length = 0; // clear select options
            sel.options[0] = new Option('TEXT', 'VALUE');
            sel.options[1] = new Option('TEXT', 'VALUE');
            sel.options[2] = new Option('TEXT', 'VALUE');
            sel.options[3] = new Option('TEXT', 'VALUE');
            break;
        default:        
            sel.options.length = 0;
            sel.options[0] = new Option('1 - 1000 words', 'Lessthan1000');
            sel.options[1] = new Option('1001 - 2000 words', 'Lessthan2000');
            sel.options[2] = new Option('2001 - 4000 words', 'Lessthan4000');
            sel.options[3] = new Option('4001 - 6000 words', 'Lessthan6000');
    }
    changeprice(sel.options[0].value); // change input value
}
Post a Comment for "Change 3 Dropdown Values Through Javascript"