In the code below, I would like to use jQuery to put the word "username" into the value field. Then, when the user selects the input box, the word “username” would disappear leaving an empty input field for the user to input his username.
Can this be done with jQuery?
<p class="login-username">
<input type="text" name="log" id="user_login" class="input" value="" size="20" tabindex="10">
</p>
You can use HTML5
placeholderfor thatAnd fix it for older browsers ( that’s the exact part you were asking )
SOURCE
UPDATE
To alter the HTML via jQuery and add a placeholder to an input field you can do this
DEMO