Jump to content

Change a field to value='' and type='password'


Vigilant Psyche

Recommended Posts

<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.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.