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

Popular posts from this blog

sql - invalid in the select list because it is not contained in either an aggregate function -

Angularjs unit testing - ng-disabled not working when adding text to textarea -

How to start daemon on android by adb -