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 ''? Link to comment https://forums.phpfreaks.com/topic/102792-change-a-field-to-value-and-typepassword/ 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. Link to comment https://forums.phpfreaks.com/topic/102792-change-a-field-to-value-and-typepassword/#findComment-526864 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.