【问题标题】:How to step next input?如何进行下一步输入?
【发布时间】:2016-07-08 07:25:50
【问题描述】:

这是我的html结构

<input type="text" class="name1" tabindex="1">
<input type="text" class="name2" tabindex="2">
<input type="text" class="name3" tabindex="3">
<input type="text" class="name4" tabindex="4">

如果我填写当前输入,它必须执行下一个输入,这怎么可能?我没有任何 jquery 代码可做,也没有任何想法

【问题讨论】:

  • 你希望下一步如何输入“字符可能很长”?只输入一个字符?
  • 一个或多个或格式(日历、年龄、字符长等)只需填写 :))
  • 那你怎么期望用户在输入中输入了全文?
  • 你是什么意思?据我所知 if-else 或类似的东西
  • @fortherest 。用户要输入的文本的确切长度是多少,,,它总是固定的吗??

标签: jquery next


【解决方案1】:

下一步输入,你可以使用.focus()

$(".name2").focus();

跳转到name2 文本框 或者

$(".name3").focus();

跳转到textboxname3

在什么情况下应该加强,你需要决定。

例如:如果文本长度限制为 8 则,

$('input').keyup(function(){
    if($(this).val().length == 8)
{
     $(this).next().focus();
}
}); 

并知道如何使用日历输入使用 datepicker 。 Click here

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-01-16
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-07-07
    相关资源
    最近更新 更多