在输入框输入第一个跳转到下一个后,边框颜色会随光标变绿色,跟pc网页支付宝输入密码那样?怎么实现呢?"" />
<!-- 注册表单 -->
<form class="form">
<div class="mui-input-row">
<input type="tel" id="tel" class="hnb-input mui-input-clear" placeholder="请输入您的手机号" maxlength='11' />
<span class="hnb-icon hnb-icon-user"></span>
</div>
<div class="mui-input-row">
<input type="password" id="password" class="hnb-input mui-input-password" placeholder="请设置不少于6位数的密码" />
<span class="hnb-icon hnb-icon-password"></span>
</div>
<div class="mui-popup mui-popup-in" style="display: block;">
</html>
2 回答
stone310
TA贡献361条经验 获得超191个赞
在这里添加了2个函数,看下是你要的效果吗
var inputtwArr = document.querySelectorAll(".inputw");
for(var i = 0, j = inputtwArr.length; i < j; i++) {
inputtwArr[i].addEventListener("keyup", function(e) {
if(this.value !== "") {
this.nextSibling.nextElementSibling.focus();
return false;
}
})
inputtwArr[i].addEventListener("focus",function(){ //光标放上去变浅绿色
this.style.borderColor="lightgreen"
})
inputtwArr[i].addEventListener("blur",function(){ //光标移开回复正常
this.style.borderColor=""
})
}添加回答
举报
0/150
提交
取消
