Password value on click is not changing the text to 'Password'
- by Sam
window.onload=function() {
var password = document.getElementById('apassword');
var real = document.getElementById('password');
var fake = document.createElement('input');
fake.setAttribute('type', 'text');
/*fake.setAttribute('id', 'password');*/
fake.setAttribute('class', 'contact-input contact-right');
password.appendChild(fake);
fake.setAttribute('value', 'Password');
fake.onfocus = function() {this.style.display='none';real.style.display='';
real.focus();};
real.style.display = 'none';
real.setAttribute('value', '');
real.onblur = function() {if(this.value==''){this.style.display='none';fake.style.display=''}};
};
AND
<label id="apassword">
<input type="password" title="Password" id="password" class="contact-input contact-right" name="password" />
</label>
What is supposed to happen is that when you click on the input box, it changes from 'Password' to a blank type="password" input box, however it doesn't happen. This originally worked, but then I had to change some ID's and classes etc. I'm not sure how to debug scripts, so hopefully someone can help me with that, and also with my question :).
Thankyou :).