A very basic, very small placeholder jQuery plugin. It’s only 756 bytes when minified and you can always remove the license text, making it about 300 bytes shorter, but you really shouldn’t do that :)
This plugin is useful when you want a text field to display a value that hints at what the user is supposed to type. Text disapears when text field is focused and restored if the text field is left blank.
Tested with jquery 1.3.2 and 1.4.0.
$("input").placeholder();
Option | Description | Default Value |
text | text to serve as placeholder | ‘enter text’ |
cls | class given to element while placeholder text is active | ‘placeholder’ |
clearOnSubmit | clear the input if the placeholder text is still active when the parent form is submited | true |
Added clearOnSubmit option.
756 bytes minified
First version of the plugin.
622 bytes minified