废话不多说,直接上代码:
<div class="m-regForm__block ">
<label for="password" class="u-label">设置密码</label>
<input type="text" style="display: none;">
<input type="password" style="display: none;">
<input type="text" id="password" class="u-input" maxlength="16"
onfocus="this.type='password'" autocomplete="off"
placeholder="请输入6~16位密码">
</div>
1.在密码框之前,加两个input,如上图。
<input type="text" style="display: none;">
<input type="password" style="display: none;">
2.密码框type设置为text,设置onfocus事件,并加上Html5新属性 autocomplete="off"
【type="text" οnfοcus="this.type='password'" autocomplete="off"】