我有如下的代码不点火:的JQuery模糊事件在IE
$(document).ready(function() {
let element = $('.inputField');
element.on({
'input': function(e) {
console.log('input');
},
'blur': function(e) {
console.log('blur');
}
});
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<input class="inputField">
<input>
<button>Click here</button>
我用两个events
我input
。第一个事件是input
。我用这个来检测是否有东西写在我的输入中。第二个是blur
。通过这个事件,我检测到我的输入上的focus
是否丢失(例如在下一个输入中使用tab)或用户在输入外部单击(例如在按钮上)。现在这工作正常chrome
。我也需要它internet explorer
,但模糊不起作用。我看了看这个问题:
jQuery blur() or focusout() not firing in Internet Explorer
Blur event not working in IE11 and IE10
我无法找到一个解决我的问题。有任何想法吗?谢谢
Umh ... IE不支持ES6箭头功能,旧IE不支持任何ES6功能。 – Teemu
带有单个语句的箭头函数不需要大括号,例如它应该是“输入”:(e)=> console.log('input',e)' – danwellman
我试过了,它在IE 11上工作。 https://gyazo.com/825344ceacaf38c633277786fa977c00 – Beginner