Adding default text to the search textfield
This recipe will outline the steps required to add a default string of text to the search textfield. The text will only be visible when the field does not have keyboard focus.
Getting ready
We will be using the mysite module created earlier in this book to hold our odds and ends. It is assumed that this module has been created and is enabled. It is also assumed that the search module has been enabled and that the search field option has been activated for our theme and is visible on all pages.
We will be using a jQuery plugin named AutoFill from http://plugins.jquery.com/project/jQuery-AutoFill. It can also be downloaded directly from http://github.com/joemsak/jQuery-AutoFill.
How to do it...
The following steps are to be performed inside the mysite module folder at sites/all/modules/mysite
.
Browse into the
js
folder which should contain all our JavaScript files. If this folder does not exist, create it.Open the downloaded AutoFill plugin and extract...