• 当前标签:密码框

程序开发 密码框的明密文(显示和隐藏) 显示

做密码输入框经常使用点击显示密码功能, <input id="password" class="layui-input" autocomplete="off" maxlength="15" name="password" required="" type="password" placeholder="密码为6-15位非纯数字" /> <i id="passwordeye" class="icon iconfont icon-yincangmima"></i> 图标点击js: $('#passwordeye').click(switchPwd()); function switchPwd() {     var passwordeye = $('#passwordeye');     var showPwd = $("#password");     passwordeye.off('click').on('click',function(){         if(passwordeye.hasClass('icon-yincangmima')){             passwordeye.removeClass('icon-yincangmima').addClass('icon-xianshimima');//密码可见             showPwd.prop('type','text');         }else{             passwordeye.removeClass('icon-xianshimima').addClass('icon-yincangmima');//密码不可见             showPwd.prop('type','password');         };     });  }

2018-01-11 17:11:03 139 0 0
阅读详情
  • 1
前往