Created
December 9, 2011 05:25
-
-
Save AndorChen/1450312 to your computer and use it in GitHub Desktop.
Revisions
-
AndorChen created this gist
Dec 9, 2011 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,26 @@ /** * jQuery.HTML5 placeholder - Placeholder plugin for input fields * Written by Ludo Helder (ludo DOT helder AT gmail DOT com) * Licensed under the WTFPL (http://sam.zoy.org/wtfpl/). * Date: 2010/11/18 * * @author Ludo Helder * @version 1.0.1 * **/ $(function(){ var d = "placeholder" in document.createElement("input"); if (!d){ $("input[placeholder]").each(function(){ $(this).val(element.attr("placeholder")).addClass('placeholder'); }).bind('focus',function(){ if ($(this).val() == element.attr('placeholder')){ $(this).val('').removeClass('placeholder'); } }).bind('blur',function(){ if ($(this).val() == ''){ $(this).val(element.attr("placeholder")).addClass('placeholder'); } }); } });