因为我正在创建一个 HTA 代码,所以我被 IE 困住了 :(
我们需要在<select>
元素中捕获更改事件,但猜猜看,IE 不支持该事件。
所以我创造了一种模仿它的方法。当<input type="text">
它被点击时,显示<select>
下面的内容。那部分工作正常。问题是,select
当用户在select
.
我试图抓住一个click
,body
它第一次工作正常,但第二次select
被隐藏尝试了。
这是代码的简化版本:
$('.product').live('click',function(){
// Show the <select id="select"> code goes here
// this is the event to close the select
$('body').die().live('click', function(){ $('#select').fadeOut(250); return;});
// get the click on the select element
$('#select').die().live('click',function(){
// kill the close the select
// THIS IS THE .die() THAT DOES NOT WORK
$('body').die();
});
问题 这段代码有问题吗?或者有没有更好的方法来做到这一点?请记住,我被 IE 困住了。