Hi Expert!
Can I change an input field value using CSS when user clicks it?
Like:
<input type=text name=username>
<input type=password name=password>
So, when the user click into this field, the text will go away and he will be able to write something.
Thanks!
AVADHESH PATEL
05-Mar-2013Hi John!
If you change input value then you can do as below, there is no role of css
<input type="text" name="username" placeholder="Username" />
Because "placeholder" attribute not suported by all browser, then you can achive this using JavaScript.
<input type="text" name="username" onFocus="if(this.value=='Username') this.value='';" onBlur="if(this.value=='') this.value='Username';" value="Username" />