Vigilant Psyche Posted April 24, 2008 Share Posted April 24, 2008 Hey, guys. How can I make a field which says somewthing like 'enter password' orignially but on clicking it changes to 'password' type and 'enter password' value changes to ''? Quote Link to comment Share on other sites More sharing options...
Goose Posted April 25, 2008 Share Posted April 25, 2008 <script type="text/javascript"> function makePass(obj){ obj.value = ''; obj.type = 'password'; } </script> <input type="text" onfocus="makePass(this);" value="enter password" /></input> So, basically what I did was bind the function makePass() to the focus event on the element. Meaning that when the user puts their cursor over the field and clicks on it, the event is called. The function then simply takes the calling object and changes the value and the type. Enjoy. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.