javascript - I have MultipleSeletion Dropdown I want to deselect sleceted values of the dropdown do not Know how to do this -
now using code unselect selected values of dropdown not working
var diag = document.getelementbyid('<%=seldiag.clientid%>'); var diag1 = ""; var diag2 = ""; var diag3 = ""; var diag4 = ""; var options = diag.getelementsbytagname('option'); (var = 0, len = options.length; < len; i++) { options[i].selected == false; }
'=='
comparison operation, need use '='
var diag = document.getelementbyid('tst'); var options = diag.getelementsbytagname('option'); (var = 0, len = options.length; < len; i++) { options[i].selected = false; }
<select id="tst" multiple> <option value="volvo" selected>volvo</option> <option value="saab">saab</option> <option value="vw">vw</option> <option value="audi" selected>audi</option> </select>
Comments
Post a Comment