Reputation: 911
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....
Any help super appreciated... Thanks in advance....!!
Upvotes: 6
Views: 4300
Reputation: 3103
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
Upvotes: 3
Reputation: 171669
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
Upvotes: 2