<input autocomplete="off" id="username" type="text" name="username" placeholder="请输入用户名" required="" >
<input id="password" type="text" name="password" placeholder="请输入密码" required="" >
<script>
$("#password").focus(function(){
if(this.value.length>0){
this.type = "password";
}
else{
this.type = "text";
}
});
$("#password").keyup(function(){
if(this.value.length>0){
this.type = "password";
}
else{
this.type = "text";
}
});
</script>
1.经测试,谷歌,火狐下都通过测试,保存的密码不会填充进去。