看图:
我想要设计类似于图像中的内容,其中用户需要输入 4 位数字一次性密码 (OTP)。现在我已经通过 4 个单独的输入实现了这一点,然后在 javascript 中组合值:
<input type="text" class="form-control" placeholder="0" maxlength="1" />
<input type="text" class="form-control" placeholder="0" maxlength="1" />
<input type="text" class="form-control" placeholder="0" maxlength="1" />
<input type="text" class="form-control" placeholder="0" maxlength="1" />
我不确定这是否是正确的方法。我认为必须有一些样式选项,通过这些选项,一个输入文本框会像图像中一样显示为分区。是否可以使用引导程序?如何设置一个输入控件的样式以显示为输入的分区字段?