Skip to content

yohannrub/jquery.input-placeholder

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 

Repository files navigation

jQuery Input Placeholder

jQuery Input Placeholder is a lightweight jQuery plugin that enables HTML5 input placeholder attribute support for legacy browsers (e.g. IE <= 9).
It uses the input value property to mimic the placeholder behavior (therefore note that it cannot mimic HTML5 placholder behavior with password inputs).
It handles properly input focus, input blur, form submit and form reset events.

Demo page

Usage

Just import the javascript file into your html page, and use placeholder attribute normally in input/textarea html elements.

<input type="text" name="input" placeholder="Placeholder input" />
<textarea name="textarea" placeholder="Placeholder textarea"></textarea>

Styling

The plugin toggles a 'placeholder' CSS class for browser that don't natively support placeholders:

.placeholder {
  color: #aaaaaa;
}

As a reminder, styling of HTML5 placeholders for browser that natively support placeholders:

::-webkit-input-placeholder {
  color: #aaaaaa;
}
:-moz-placeholder {
  color: #aaaaaa;
}

Extra

$.support.placeholder is assigned true if input placeholder attribute is natively supported by the browser, false otherwise.

About

A lightweight jQuery plugin that enables HTML5 input placeholder attribute support for legacy browsers

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published