// HTML5 placeholder plugin version 1.01 // Copyright (c) 2010-The End of Time, Mike Taylor, http://miketaylr.com // MIT Licensed: http://www.opensource.org/licenses/mit-license.php // // Enables cross-browser HTML5 placeholder for inputs, by first testing // for a native implementation before building one. // // // USAGE: //$('input[placeholder]').placeholder(); // (function($){ //feature detection var hasPlaceholder = 'placeholder' in document.createElement('input'); //sniffy sniff sniff -- just to give extra left padding for the older //graphics for type=email and type=url //var isOldOpera = $.browser.opera && $.browser.version < 10.5; var isOldOpera = false; $.fn.placeholder = function(options) { //merge in passed in options, if any var options = $.extend({}, $.fn.placeholder.defaults, options), //cache the original 'left' value, for use by Opera later o_left = options.placeholderCSS.left; //first test for native placeholder support before continuing //feature detection inspired by ye olde jquery 1.4 hawtness, with paul irish return (hasPlaceholder) ? this : this.each(function() { //TODO: if this element already has a placeholder, exit //local vars var $this = $(this), inputVal = $.trim($this.val()), inputWidth = $this.width(), inputHeight = $this.height(), //grab the inputs id for the