I used Chosen Jquery, due to which the dropdownlist was not updated.
This is HTML:
<select name="ctl00$BodyPlaceHolder$ddl1" id="ddl1" class="chose-select le"> <option value="Select a State">Select a State</option> <option value="Alabama">AL</option> <option value="Alaska">AK</option> <option value="Arizona">AZ</option> </select>
JavaScript that sets the selected index to 0:
function setSelectedIndex(dropdownlist, selVal) { var ddl1 = document.getElementById(dropdownlist); if (selVal < ddl1.selectedIndex) { ddl1.selectedIndex = selVal; $(ddl1).val(0).trigger('chosen:updated'); } }
This is a trick with one problem. The problem is that after the function sets the selected index to 0, it shows "Select an option" as index 0 instead of the first default option.

Any idea how to fix this?
SearchForKnowledge Apr 15 '15 at 17:20 2015-04-15 17:20
source share