javascript - Set default value of a password input so it can be read -


i want have password field says "password" in before user enters password (so know field is)

i'd rather use javascript, importing jquery alone seems wasteful, have no idea how to. images explain quite clearly:

what looks like:

enter image description here

what want like:

enter image description here

it's simple website , basic of logins (has no validation etc)

any ideas?

<input id="username" name="username" class="input_text" type="text" value="username"  /> <input id="password" name="password" class="input_text" type="password" value="password" />                  

change password input simple input type text. then, javascript (or jquery) on focus event, change input type password.

here little untested sample plain javascript (no jquery):

<html> <head>    <script type="text/javascript">       function makeitpassword()       {          document.getelementbyid("passcontainer")             .innerhtml = "<input id=\"password\" name=\"password\" type=\"password\"/>";          document.getelementbyid("password").focus();       }    </script> </head> <body>    <form>       <span id="passcontainer">          <input onfocus="return makeitpassword()" name="password" type="text" value="type password" />       </span>    </form> </body> </html> 

Comments

Popular posts from this blog

java - SNMP4J General Variable Binding Error -

windows - Python Service Installation - "Could not find PythonClass entry" -

Determine if a XmlNode is empty or null in C#? -