我正在寻找一种让用户复制一个多行地址粘贴到一个网页中,每个地址行有一个输入字段,这样不仅第一行被粘贴,而且程序自动跳转到下一个字段并将第2行放在那里,等等。将多个文本行粘贴到多个html输入框中
下面是我好不容易才找到的代码,但它仅限于字数。在下面的代码是1 ..有什么办法这不会被一字涨停数但线数
function handleCharacter(event) {
var $input = $(this),
index = getIndex($input),
digit = $input.val().slice(0,1),
rest = $input.val().slice(1),
$next;
if (rest.length > 0) {
$input.val(digit); // trim input value to just one character
$next = $('.text-input[name="chars['+ (index + 1) +']"]');
if ($next.length > 0) {
$next.val(rest); // push the rest of the value into the next input
$next.focus();
handleCharacter.call($next, event); // run the same code on the next input
}
}
}
function handleBackspace(event) {