密码框的明密文(显示和隐藏) 显示

做密码输入框经常使用点击显示密码功能,

<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');
        };
    });
 }
暂无评论

发送评论 编辑评论


				
|´・ω・)ノ
ヾ(≧∇≦*)ゝ
(☆ω☆)
(╯‵□′)╯︵┴─┴
 ̄﹃ ̄
(/ω\)
∠( ᐛ 」∠)_
(๑•̀ㅁ•́ฅ)
→_→
୧(๑•̀⌄•́๑)૭
٩(ˊᗜˋ*)و
(ノ°ο°)ノ
(´இ皿இ`)
⌇●﹏●⌇
(ฅ´ω`ฅ)
(╯°A°)╯︵○○○
φ( ̄∇ ̄o)
ヾ(´・ ・`。)ノ"
( ง ᵒ̌皿ᵒ̌)ง⁼³₌₃
(ó﹏ò。)
Σ(っ °Д °;)っ
( ,,´・ω・)ノ"(´っω・`。)
╮(╯▽╰)╭
o(*////▽////*)q
>﹏<
( ๑´•ω•) "(ㆆᴗㆆ)
😂
😀
😅
😊
🙂
🙃
😌
😍
😘
😜
😝
😏
😒
🙄
😳
😡
😔
😫
😱
😭
💩
👻
🙌
🖕
👍
👫
👬
👭
🌚
🌝
🙈
💊
😶
🙏
🍦
🍉
😣
Source: github.com/k4yt3x/flowerhd
颜文字
Emoji
小恐龙
花!
上一篇
下一篇