Sha256: 18b54215829ef17cffb54b7c103f0ef7492646627b5fffb05a74e795bf3902b9
Contents?: true
Size: 1.59 KB
Versions: 6
Compression:
Stored size: 1.59 KB
Contents
/* * EnablePlaceholder jQuery plugin. * https://github.com/marioizquierdo/enablePlaceholder * version 1.2.2 (Oct 02, 2011) * * Copyright (c) 2011 Mario Izquierdo * Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php) * and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses. */ (function(){var a,c,b,d;a=jQuery;a.support.placeholder=document.createElement("input").placeholder!=null;a.EnablePlaceholder={defaults:{withPlaceholderClass:"placeholder"},alsoForModernBrowsers:false};c=function(h,f,e){var g;if(!a.support.placeholder||a.EnablePlaceholder.alsoForModernBrowsers){g=a.extend({},a.EnablePlaceholder.defaults,f);return h.each(function(){return e(a(this),g)})}};b=function(e,f){return e.bind("focus focusin keydown paste",function(){return e.clearPlaceholder(f)})};d=function(e,f){return e.bind("blur focusout",function(){return e.showPlaceholder(f)})};a.fn.enablePlaceholder=function(e){return c(this,e,function(f,g){b(f,g);d(f,g);f.parents("form").submit(function(){f.clearPlaceholder(g);return true});a(window).unload(function(){f.clearPlaceholder(g);return true});return f.showPlaceholder(g)})};a.fn.showPlaceholder=function(e){return c(this,e,function(f,g){if(f.val()===""){return f.val(f.attr("placeholder")).addClass(g.withPlaceholderClass).data("ph_active",true)}})};a.fn.clearPlaceholder=function(e){return c(this,e,function(f,g){if(f.data("ph_active")){return f.val("").removeClass(g.withPlaceholderClass).data("ph_active",false)}})};a.fn.updatePlaceholder=function(f,e){return this.clearPlaceholder(e).attr("placeholder",f).showPlaceholder(e)}}).call(this);
Version data entries
6 entries across 6 versions & 2 rubygems