html复制输入框文本,将多个文本行粘贴到多个html输入框中

我正在寻找一种让用户复制一个多行地址粘贴到一个网页中,每个地址行有一个输入字段,这样不仅第一行被粘贴,而且程序自动跳转到下一个字段并将第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) {

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值