Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

A simple jQuery plugin that adds support for the HTML5 placeholder attribute on older browsers.

branch: master

Fetching latest commit…

Octocat-spinner-32-eaf2f5

Cannot retrieve the latest commit at this time

Octocat-spinner-32 min
Octocat-spinner-32 .gitignore
Octocat-spinner-32 README.md
Octocat-spinner-32 example.html
Octocat-spinner-32 jquery.auto-placeholders.coffee
README.md

jQuery Auto Placeholders <1kb

This simple jQuery plugin adds support for the HTML5 placeholder attribute on older browsers.

It automatically checks the browser compability, and if it doesn't support placeholders this plugin will mimic the exact behaivior.

Usage

Import jquery.auto-placeholders.js

<script type="text/javascript" src="min/jquery.auto-placeholders.js"></script>

If you want the placeholder to look like a real placeholder you should also add this CSS:

.placeholder {
    color: darkGrey;
}

And then you can use this on any HTML element:

$("#example_form").autoPlaceholders()

Dependencies

  • Tested against jQuery 1.7.1
  • Will use Modernizr if detected, but doesn't depend on it.
Something went wrong with that request. Please try again.