Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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....!!

like image 703
Pratik Bhatt Avatar asked Oct 06 '22 05:10

Pratik Bhatt


1 Answers

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

like image 155
Dinkar Thakur Avatar answered Oct 10 '22 03:10

Dinkar Thakur