I am currently using:
<input type="text" value="username" onfocus="this.value=''" name="login" id="login">
on my sign in form field on my site, which populates the form with the word "username" until the user clicks on the field, which is then cleared.
The problem is, if the user clicks on the field, types something in, clicks away, and clicks back, it clears whatever they have typed!
I am already using prototype on my site so I was wondering if there was a way, using prototype, I could just have the very first "onfocus" clear the field, but never again after that.
Does this make sense? I am having trouble googling any resources, can someone point me in the right direction?
I tried:
<input type="text" value="username" onfocus="if (this.value = 'username') this.value = ''" name="login" id="login">
and it doesn't seem to be working
Only conditionally clear it:
if (this.value == 'username') this.value = ''