下面是一个例子的jsfiddle我一直在努力:自动选项卡下一个空白文本输入框
http://jsfiddle.net/4m5fg/143/
HTML:
<input type="text" maxlength="1" size="1"/>
<input type="text" maxlength="1" value="e" tabindex="-1" size="1" readonly />
<input type="text" maxlength="1" size="1"/>
<input type="text" maxlength="1" value="r" tabindex="-1" size="1" readonly />
<input type="text" maxlength="1" size="1"/>
JS:
$("input").bind("input", function() {
var $this = $(this);
setTimeout(function() {
if ($this.val().length >= parseInt($this.attr("maxlength"),10))
$this.next("input").focus();
},0);
});
在上面的例子中,如果我从最左边的文本框开始,那么当字符输入时我怎么能这样做在这个文本框中,光标前进到下一个空白文本框(而不是下一个填充的文本框)---并使其以其他文本框的方式继续。
您正在使用什么版本的jQuery? – 2014-09-06 20:47:01