| Form values that disappear on click
|
whatson

msg:4483383 | 5:28 am on Aug 10, 2012 (gmt 0) | You know those search forms that have something like "Enter your text here" as an initial value in them, then you click in the field, and the text disappears. How is that done? I assume it's java, but I guess it could be css. Either way, how do you do it?
|
daveVk

msg:4483479 | 11:37 am on Aug 10, 2012 (gmt 0) | see [webmasterworld.com...] for JavaScript solution ( java is something completely different ). Not aware of css solution.
|
rwilson

msg:4483543 | 2:21 pm on Aug 10, 2012 (gmt 0) | Try this. <input type="text" onblur="if (this.value=='') { this.value='Please enter your text'; }" onfocus="if (this.value=='Please enter your text') { this.value=''; }" value="Please enter your text" id="search" name="search">
|
Fotiman

msg:4483572 | 3:18 pm on Aug 10, 2012 (gmt 0) | HTML5 has added a "placeholder" attribute, so you don't need any scripting for this at all. [diveintohtml5.info...] Internet Explorer 9 or earlier doesn't support this, so you'd still need a JavaScript solution for those cases.
|
|
|