开发者

onpropertychange event vs keyup

开发者 https://www.devze.com 2023-03-23 06:31 出处:网络
I\'m trying to mimic Google suggestions over here: yous-design It works perfect in Chrome/Firefox etc. but not in IE. I googled for it and it turns out that IE doesn\'t support the oninput event whi

I'm trying to mimic Google suggestions over here: yous-design

It works perfect in Chrome/Firefox etc. but not in IE. I googled for it and it turns out that IE doesn't support the oninput event which in the code looks like this:

el("inp").oninput=function(){
  addScript("http://www.google.nl/complete/search?callback=suggest&q="+this.value);
}

Instead I would have to use the onpropertychange event for IE. But when I replace the event it still doesn't work. I think this piece of code is counteracting:

$('#inp').keydown(
function (e){
    var curr = $('#开发者_如何学编程test').find('.current'); etc.etc.etc.

I think the keydown(/keyup) is counteracting with the onpropertychange event. But what should I replace keydown/keyup with? Are there any other alternatives at all? Should I rewrite the code?


I would suggest that instead of onpropertychange, use onKeyUp on IE.

onpropertychange is buggy in IE and doesn't fire for all keys (delete and backspace I think).

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号