Possible duplicate:How to create an HTML text box with a hint when empty?
Very simple question. I would like to put a tooltip in a text box similar to the StackOverflow log. I want the phrase to appear in the text box, and when the user enters a new value, the word "discount" disappears from the text box.
Can I do it myself using events like OnBlur, OnChange, etc. (I do not know what)? Or has something done already around?
thanks
As rudeovski said, you can use placeholder in modern browsers.But for the older one you will need a javascript / jQuery reserve.Here is a good example:
http://uniquemethod.com/html5-placeholder-text-with-modernizr-and-jquery-fallback
This will automatically generate a placeholder backup for you.You just need to write:
<input type="text" id="discount" placeholder="discount" />
Modernizr combined with jQuery does the rest for you.Hope this help :)
You can use placeholder text for this.
For it to work on all browsers, you need to use jquery / javascript for this. As far as I know, it does not work in IE.