pixelhandler

Pushin' & pullin' pixels on the net

searchText() jQuery Plugin to Add Helper Text in Search Input

This jQuery plugin script added text to an input field in a search form. The defaults are set to the IDs used in a WordPress search form. The behavior can be set to force clearing of text every time user causes focus event to fire in text input (clicks to type). The function tirggers the focus event to start off with the helper text in the input field. Demo and Qunit tests Liquid error: bad URI(is not URI?): https://raw.github.com/gist/665652/jquery.htmlsrc.searchText.js # Use the plugin in your document ready :
// use plugin when WordPress search form id is present
$('#searchform').searchText();
Or,
// call plugin with option to force reseting the text on focus
$('#searchform').searchText({
	helperText : 'Search',
	inputId    : '#s',
	forceReset : true
});
Clone the code snippet with git…
git clone git://gist.github.com/665652.git

Comments