What's the best way to have a text input field that displays instructions of what to enter in that field in gray. When you focus on that input field, the gray instruction text disappears and your input text appears black. If you erase your input text and focus away from that input, then the instruction gray text reappears.
I've tried implementing this with jQuery, but I get all kinds of weird issues with different browsers. Sometimes when you go back a screen, the instruction text becomes black and no longer disappears, issues like that.
Is there a standard javascript library for this? I can't find any!
Oh, and the instruction text can't be an image because it has to be available in different languages depending on the browser's language preference.
You don't need javascript for this.
HTML5:
<input type="text" id="email" name="email" placeholder="Enter your email address">
This works in modern browsers. If you add modernizr.js to your page then it'll work in all browsers.