登录验证眼睛效果

jsp:

<td>
<input type="password" name="psw" id="psw" class="psw" placeholder="请输入您的原密码"/>
<i for="psw" id="a" class="passwordIcon"></i>
</td>

js:

$(".passwordIcon").click(function(){
  var type = $("#" + $(this).attr("for")).attr('type') == 'text' ? 'password' : 'text';
  $("#" + $(this).attr("for")).attr('type',type);
  $(this).toggleClass("eyeStyle");
})

posted @ 2018-05-22 13:56  吾将上下而求之  阅读(97)  评论(0编辑  收藏  举报