jQuery Placeholder
Categories
Component ID
Component name
Component type
Maintenance status
Development status
Component security advisory coverage
Downloads
Component created
Component changed
Component body
Now you can use the lovely HTML5 'placeholder' attribute and have it work 'everywhere'. This module integrates the HTML5 Placeholder jQuery Plugin found here:
https://github.com/mathiasbynens/jquery-placeholder
with Drupal. This is a javascript-only method of making the HTML5 placeholder attribute work in old browsers which don't support it.
Note: The latest version of this plugin requires jQuery 1.6+. For an older version that works under jQuery 1.4.2+ (which Drupal 7 includes by default) see v1.8.7.
(It should also work with any other jQuery plugin which is called in the same way - e.g. https://github.com/danielstocks/jQuery-Placeholder)
Installation
1. Download the jQuery placeholder plugin of your choice to, e.g., sites/all/libraries/jquery.placeholder
2. Install the Elements module
3. Use the '#placeholder' attribute on form elements!
Usage
It should JustWork with the Elements module, allowing you to use placeholders on your form elements as follows:
$form['mytextfield'] = array(
'#type' => 'textfield',
'#title' => t('My example textfield'),
'#placeholder' => t('Please enter a value'),
);
Alternatively you can enable it on all textfield inputs and textareas on an entire page by calling:
jquery_placeholder_global();
