自从我创建一个HTA代码,我坚持使用IE :(jQuery的模具()不工作
我们需要捕获在<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浏览器。
Internet Explorer(至少7个或更多)确实支持“更改”事件。 [这里是一个jsfiddle演示。](http://jsfiddle.net/23qm3/) – Pointy
@Pointy你可以发布到一个答案,所以我可以投票给你。你应该去上学。 –
哈哈确定!只需一秒... – Pointy