H5隱藏密碼與顯示 HTMLbash
<div class="weui-cell__bd new_password">
<input class="weui-input" placeholder="請輸入您的原始密碼" value='213' type="password" maxlength="16">
</div>
<div class="weui-cell__ft">
<span class="iconfont icon-yanjing1 icon-hide"></span>
</div>
複製代碼
jside
var iconeye=$('.icon-hide'),
password=$('.new_password').find('input');
password.type="password";
function hideShowpPsw(){
if(password.type=='password'){
password.type='text';
iconeye.removeClass('icon-yanjing1').addClass('icon-yanjing');
password.attr('type','text');
}else{
password.type='password';
password.attr('type','password');
iconeye.removeClass('icon-yanjing').addClass('icon-yanjing1')
console.log(password);
}
}
$('.weui-cell__ft').on('click','span',function(){
hideShowpPsw()
})
複製代碼