jQuery HTML5 placeholder plugin
in Javascript
The plugin adds cross-browser support for the HTML5 placeholder attribute functionality.
Usage
In order for the plugin to work, insert the following code inside your $(document).ready function:
$.placeholder();
Customization
The plugin comes with two customization options:
$.placeholder({
'className': 'placeholder',
'attrName': 'placeholder'
});
- The
classNameparameter lets you pick the class which is toggled on the input element that has theplaceholderattribute specified. - The
attrNameparameter lets you choose which attribute to look for. For instance, you could make use of the placeholder functionality using an attribute different thanplaceholder, eg.data-placeholder.