Skip to content

Adds placeholder text/style for empty text inputs and textareas

Notifications You must be signed in to change notification settings

joshgaber/InnerLabel

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 

Repository files navigation

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

About

Adds placeholder text/style for empty text inputs and textareas

Resources

Stars

Watchers

Forks

Packages

No packages published