jQuery: textbox keyup firing twice

前端 未结 8 1860
南笙
南笙 2021-01-11 16:09

I\'m having a textbox and assigned the following function (it\'s the only function assigned):

txt.bind(\"keyup\",function(event){
    if(event.keyCode==13)
          


        
8条回答
  •  借酒劲吻你
    2021-01-11 16:50

    I'm having the same issue - keyup and keydown events are being fired twice though their handlers are bound only once and I'm definitely attaching them to only one element.

    The interesting point is that this behavior can be observed only in Internet Explorer and in just one special case where my webapp is displayed in an embedded ActiveX control (CLSID_InternetExplorer). OS: Windows 7, IE 8, embedded ActiveX control is running in IE7 compatibility mode.

    I've found a workaround however - process the jQuery's keypress event, which made also more semantic sense in my webapp.

提交回复
热议问题