Tab键无法使用HTML和javascript

Tab key is not working using HTML and javascript

本文关键字:HTML javascript Tab      更新时间:2023-09-26

我在使用HTML输入Tab键时遇到一个问题。我在下面解释我的代码。

<div class="input-group bmargindiv1 col-md-12">
   <span class="input-group-addon ndrftextwidth text-right" style="width:180px">User Name :</span>
   <div ng-class="{ 'myError': billdata.uname.$touched && billdata.uname.$invalid }">
      <input type="text" name="uname" id="uname" class="form-control" placeholder="add user Name" ng-model="login_name" ng-minlength="6" ng-keypress="clearField('uname');" >
   </div>
</div>
<div class="help-block" ng-messages="billdata.uname.$error" ng-if="billdata.uname.$touched">
   <p ng-message="minlength" style="color:#F00;">This field is too short.The min length of your user name should be 6.</p>
</div>
<div class="input-group bmargindiv1 col-md-12" ng-hide="showpass">
   <span style="position:absolute; right:5px; margin-top:6px; top:0px;"><button class="btn btn-xs btn-success"ng-mousedown="hideShowPassword();" ng-mouseup="hideShowPassword();" ng-mouseleave="hidePassAfterLeave();"  ><i class="fa fa-eye"></i></button></span>
   <span class="input-group-addon ndrftextwidth text-right" style="width:180px">Password :</span>
   <div ng-class="{ 'myError': billdata.pass.$touched && billdata.pass.$invalid }">
      <input type="{{inputType}}" name="pass" id="passno" class="form-control" placeholder="password" ng-model="password" ng-minlength="8" ng-pattern="/^(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[_!@#'$%'^&'*])(?=.{8,})/" ng-keypress="clearField('passno');" >
   </div>
</div>

在上面的代码中,假设用户的焦点首先在user name字段中。在这种情况下,当用户按下制表键时,焦点不会移动到密码字段,而是按下制表键两次,焦点发生在密码字段上。在这里,我需要第一次按下tab键,重点应该转到密码字段。请帮帮我。

设置属性

tabindex="-1"

到你想跳过的帖子

检查这个小提琴:

JSFIDDLE