Skip to content

Instantly share code, notes, and snippets.

@lifo101
lifo101 / jquery.placeholder.js
Last active October 7, 2015 13:08
jquery plugin that adds HTML5 "placeholder" support for browsers that do not natively support it
// add HTML5 'placeholder' support to selected inputs if not natively supported.
// @example:
// $(':text[placeholder]').placeholder();
// @css:
// input.placeholder { color: #aaa; } /* since IE doesn't properly support :not() */
//
(function($){
if (document.createElement('input').placeholder !== undefined) {
$.fn.placeholder = $.noop;
} else {