PDA

View Full Version : Search Field Prompt Text


grantr281040
04-22-2009, 03:09 PM
Hi All!

I have one I can't seem to find any info for.

In the search field for my site I want to add that grayed out prompt text that you see on some sites. It ususally has a little magnifying glass icon and some text that says "search" or something to that effect and when you click in the field it disappears to allow you to type your search text.

Does anyone know how I might go about adding that to my search field on my site.

Thanks for all!

Grant

Justin Nemeth
04-23-2009, 12:29 PM
This would involve CSS and JavaScript. Use CSS to style the input box with a background-image of the magnifying glass. Then you can use JavaScript to handle the onclick and blank out the field if it is set to defaultValue. I am not sure of any good scripts that do this out of the box, but it shouldn't be too hard.

Ray Borduin
04-23-2009, 12:50 PM
I seem to remember spry has a solution for this. You may want to look at adobe's web site for an example of doing this with spry in Dreamweaver.