在Chrome中使用jquery更改事件不会触发文本输入 [英] Change event not firing on text input using jquery in Chrome

查看:132
本文介绍了在Chrome中使用jquery更改事件不会触发文本输入的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对文本输入上的jQuery更改事件有问题,按照预期在Firefox和IE中运行,但在Chrome中无效。我还在文本输入上有一个关键事件来处理输入,但输入完成后,我需要运行一些额外的代码。我尝试使用'blur'事件和'focusout'事件,因为这里有人提出了替代方案,但后来我根本无法改变焦点 - 输入不停地抓住它。代码如下:
$ b $ $ $ $ $'''$'$。$'''''''''''''''''''''''' });
$('。textInput')。change(function(event){alert('Changed!'); / *做其他的事情* /});

和html:

 < input type =textclass =textInputvalue =/> 

我正在使用jQuery 1.6.3。任何建议将不胜感激。
H。

解决方案

更改事件不会触发,除非输入焦点切换到其他控件


I have a problem with a jquery change event on a text input that works as expected in Firefox and IE but not in Chrome. I also have a keyup event on the text input to manipulate the input as it is entered, but when the input is done I need to run some extra code. I tried using the 'blur' event and the 'focusout' event as someone here had suggested as a substitute, but then I couldn't change focus at all -- the input kept grabbing it back somehow. Here is the code:

 $('.textInput').keyup(function(event) { /* do stuff */ });
 $('.textInput').change(function(event) { alert('Changed!'); /* do other stuff */ });

and the html:

 <input type="text" class="textInput" value="" />

I am using jQuery 1.6.3. Any suggestions would be greatly appreciated. H.

解决方案

The change event will not fire unless the input focus switched to other controls

这篇关于在Chrome中使用jquery更改事件不会触发文本输入的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆