admin管理员组文章数量:1391836
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 mon , not working in IE....
DEMO
Any help super appreciated... Thanks in advance....!!
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 mon , not working in IE....
DEMO
Any help super appreciated... Thanks in advance....!!
Share Improve this question asked Jan 25, 2013 at 12:30 Pratik BhattPratik Bhatt 9112 gold badges8 silver badges21 bronze badges 5- Where are you using jquery ? Or did you mean to say you wanted a jquery answer? – Ravi Y Commented Jan 25, 2013 at 12:32
- I also tried with jQuery bt result was same it was not working... if you know that jQuery can solve this... we can use... not issue....!! – Pratik Bhatt Commented Jan 25, 2013 at 12:33
-
You can't do this in IE.
select
element is created by OS, not by browser. – Teemu Commented Jan 25, 2013 at 12:33 - 1 @Teemu any link..... to support this....!! – Pratik Bhatt Commented Jan 25, 2013 at 12:34
- @PratikBhatt I'm sorry, I can't recall the page at MSDN, and having not time to search just now... – Teemu Commented Jan 25, 2013 at 12:37
2 Answers
Reset to default 3document.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
本文标签: javascriptDouble click event not working in Internet Explorer for option listStack Overflow
版权声明:本文标题:javascript - Double click event not working in Internet Explorer for option list - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744769876a2624274.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论