简体   繁体   中英

Double click event not working in Internet Explorer for option list

HTML CODE :

<select name="options" id="options" style="width: 100%;" size="12">
        <option id="optList1" value="1">
            1. ABC
        </option>
</select>

Javascript :

document.getElementById('optList1').ondblclick = function () {
            alert("asf");
        };

I am having list in of options in select , in sample there is only one item . Issue is I need to open dialog box on double click of this option... Its working fine in Chrome and Firefox , issue is common , not working in IE....

DEMO

Any help super appreciated... Thanks in advance....!!

document.getElementById('options').ondblclick = function () {
       var optio = options.options;
var id      = options[options.selectedIndex].id;
   if(id == "optList1")
   {
      alert("abc");
   }
   else 
   {
      alert("xyz")
   }
};


<select name="options" id="options" style="width: 100%;" size="12">
    <option id="optList1" value="1.1">
        2. Enter/Update W/H Data Manually
    </option>
    <option id="optList2" value="1.1">
        1. Enter/Update W/H Data Manually
    </option>

Try this code its working fine on IE

IE does not support events on <option> tag.

Also seems strange to consider a doubleclick event on <option> as this is not anything most users would be used to doing

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM