Skip to content

Latest commit

 

History

History
65 lines (52 loc) · 2.05 KB

README.md

File metadata and controls

65 lines (52 loc) · 2.05 KB

jQuery InnerLabel

jQuery InnerLabel is a module that creates "placeholder" text within textareas and text input tags. It extends the jQuery library.

How to Use

  • Add jquery.innerlabel.min.js to your HTML file.

  • Use the following code to bind InnerLabel to an element:

    $( "textarea, input[type='text']" ).innerlabel( options );

Features

  • Very lighweight; only 2KB to load.
  • No cost; Fully licensed for commercial and non-commercial use.

Options

The parameter options is a JSON array that may use the following values:

Option Type Default Description
text string / function $(this).attr("title") The default placeholder text that you wish the field show when it is empty. If a function is passed, it will be executed every time this variable is recalled.
css array {} Any CSS styles that you wish to apply to the field while the placeholder is present. They will be removed when the field receives focus again.
onFocusIn function function() {} This function will be executed when the field receives focus, and the placeholder is present. Note: This function will execute before the placeholder is removed.
onFocusOut function function() {} This function will be executed when the field loses focus, and contains no text. Note: This function will execute before the placeholder is replaced.

Website

Author