c# - deselect item in multiitem listbox with javascript -


i trying deselect item (once selected) when user click on item in listbox. have script deselecting item on user click happening when item selected first time well. have: js:

 function deselect()           {               var list = document.getelementbyid('<%=ddlcity.clientid%>');               var listlength = list.options.length;                (var = 0; < listlength; i++) {                   if (list.options[i].selected) {                       list.selectedindex = -1;                   }               }           } 

and html:

  <asp:listbox id="ddlcity" cssclass="formfield" runat="server" datasourceid="sqldatasourcecity"                 datatextfield="description" datavaluefield="cityid" selectionmode="multiple" onclick="deselect();"                 ondatabound="dropdownlist3_databound"></asp:listbox>   

any idea how can edit js deselect value once value selected, when user selects value first time value selected. thanks, laziale


Comments

Popular posts from this blog

Unable to remove the www from url on https using .htaccess -