【发布时间】:2013-06-27 09:26:14
【问题描述】:
请看这个小提琴:http://jsfiddle.net/yg49k/
以下代码在 FireFox 中运行良好,但在最新版本的 Chrome 中无法运行。
HTML:
<input type="text" id="one" placeholder="Type two chars" />
<input type="text" id="two" placeholder="It should focus here" />
jQuery:
$("#one").on("input", function() {
if($("#one").val().length == 2) { $("#two").focus(); }
});
有谁知道我该如何解决这个问题?
【问题讨论】:
-
你为什么将 4 个参数传递给
on方法?你不必这样做。 -
哪个版本?在 29 中它工作正常。
-
有点老套,但是:jsfiddle.net/yg49k/1 现在对我有用。
-
看起来谷歌解决了这个问题,因为我的 jsFiddle 链接现在可以正常工作了。
标签: javascript jquery html google-chrome