Password field default value

前端 未结 7 2367
野的像风
野的像风 2021-01-06 09:22

How can I both use the HTML password input and set a text default value that will be readable since the password input will turn the characters into dots or stars? Can I do

7条回答
  •  夕颜
    夕颜 (楼主)
    2021-01-06 09:43

    Much easier option using ONLY HTML:

    Add this code:

    onfocus="this.value='', this.type='password'"

    to the input field and make sure the type is initially set to text

    Example:

    input onfocus="this.value='', this.type='password'" value="Password" type="text" title="Password" id="password_field" name="signin_password"
    

提交回复
热议问题