失眠网,内容丰富有趣,生活中的好帮手!
失眠网 > 登录页面的密码的显示与隐藏

登录页面的密码的显示与隐藏

时间:2024-03-09 21:50:41

相关推荐

登录页面的密码的显示与隐藏

登录用户密码的显示与隐藏(样式自行定义,仅写了简单的代码):

html部分:

<divclass="form-group"><imgsrc="img/yonghu.png"/><inputtype="text"name=""class="form-control input_item"id=""placeholder="请输入账号"required></div>

<divclass="form-group"><imgsrc="img/mima.png"alt=""/><inputtype="password"name=""class="form-control input_item "id="pwd"placeholder="请输入密码"required><imgsrc="img/eyes_hide.png"alt=""id="eyesHide"><imgsrc="img/eyes_show.png"alt=""id="eyesShow"></div>

js部分:

$("#eyesHide").click(function(){if($("#pwd").attr("type")=="password"){$("#pwd").attr('type','text');$("#eyesShow").show();$("#eyesHide").hide();}});$("#eyesShow").click(function(){if($("#pwd").attr("type")=="text"){$("#pwd").attr('type','password');$("#eyesShow").hide();$("#eyesHide").show();}});

最终结果:

如果觉得《登录页面的密码的显示与隐藏》对你有帮助,请点赞、收藏,并留下你的观点哦!

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。