Skip to content

A plugin that enables HTML5 placeholder support for legacy browsers

Notifications You must be signed in to change notification settings

CamaroSS/jQuery-Placeholder

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

46 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Placeholder plugin for jQuery

A jQuery plugin that enables HTML5 placeholder support for legacy browsers

The HTML5 placeholder attribute is awesome, unfortunately only supported by some browsers. This plugin replicates the placeholder behavior for unsupported browsers.

Compatibility:

IE 6+ Firefox 3+ Safari 3+ Chrome ✓ Opera ✓ iPhone ✓ Android ✓

Please note The placeholder attribute should not be used as an alternative to a label. http://www.whatwg.org/specs/web-apps/current-work/multipage/common-input-element-attributes.html#the-placeholder-attribute

If you must hide labels, do it with JavaScript as you activate the placeholder.

Usage

It's easy!:

$('input[placeholder], textarea[placeholder]').placeholder();

Enjoy.

Styling

Native styling of HTML5 placeholders:

::-webkit-input-placeholder {color: red;}

:-moz-placeholder {color: red;}

jQuery-Placeholder toggles a .placeholder class for browser that don't natively support placeholders:

.placeholder { color: red }

Credit

Copyright 2011, Daniel Stocks ( http://webcloud.se )

Thanks to Nikita Vasilyev and James Rosen for feedback and contribution.

About

A plugin that enables HTML5 placeholder support for legacy browsers

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%