javascript - JS Code to remove selected options works with Firefox but not IE11 -
my code (found topic : deselect selected options in select menu multiple , optgroups) :
function clearselected(id) { var select = document.getelementbyid(id); for(var = 0, len = select.options.length; < len; i++){ select.options[i].selected = false; } }
where id = id of select element contain list of options.
if run script on firefox, ok, selected options unselected. when run ie 11, doesn't work. idea of what's wrong ? tried run console, haven't error , ie correctly identifying select , options. let me know if need further info.
edit : options content of focused select dynamically generated in javascript. may not compatible ie ?
<select name="listechoix3alt" id="listechoix3altid" size="9" class="formaa" onchange='filltheselect(this.name, this.value)' style="width:330px; display: none;"> <script language="javascript"> (i=0; i<art7.length; i++) document.write("<option value=\"" +art7[i][0]+ "\">" +art7[i][1]+ "</option>"); </script> </select>
edit2 : i've made additional tests :
<select name="listechoix3alt" id="listechoix3altid" size="9" class="formaa" style="width:330px; display: none;"> <option value="n0">cds fermé</option> <option value="n1">compte bloqué</option> <option value="n2">pas de place sur le planning</option> <option value="n3">pas de produit disponible dans le délai attendu par le client</option> </select> <a href="#" onclick="clearselected('listechoix3altid');">clear</a>
when click on clear firefox, working fine. ie, nothing happens ! make me crazy !
Comments
Post a Comment