InlineFieldLabel is a project mainly written in JavaScript, it's free.
This plugin allows to input a default text label inside an input text element or a text area.
/*
- inlineFieldLabel 1.2.0 (UPDATE for gavri (Linnovate.net) library)
-
- Dual licensed under the MIT (MIT-LICENSE.txt)
- and GPL (GPL-LICENSE.txt) licenses.
-
- Date: 2010-09-4 12:22:17 +0200 (Fri, 24 May 2008)
This plugin allows to input a default text label inside an input text element or a text area.
Very common on search boxes, login forms or any other short forms.
Features
- When the field gets focus the label disappears.
- When the user submits the form the label is discarded.
- If the user didn't insert any value after focusing the field - the label returns on blur.
Examples
Suppose we have this form:
You can use this script to add the label search inside the form:
$('input#search').inlineFieldLabel();
And recommended for Drupal websites or any other CMS.
This update fixed some issues:
- Display the input value if set. It was displayed as empty string if set.
- Fix password issue. It was always generate the cloned password field with the same name which was leading not to send the password input value
- If the field is set to the fieldLabel on submit, clear the field on sumbit form not on button submit to handle cases where submit button is hidden
- Check attribute title instead of forcing label
*/