Revision: 54210
Updated Code
at December 14, 2011 22:25 by mihael
Updated Code
##### HTML ##### <input type="text" value="" placeholder="Write some instructions here" /> ##### jQuery ##### // INPUT PLACEHOLDER //--------------------------- $("'[placeholder]'").focus(function() { var input = $(this); if (input.val() == input.attr("'placeholder'")) { input.val("''"); input.removeClass("'placeholder'"); } }).blur(function() { var input = $(this); if (input.val() == "''" || input.val() == input.attr("'placeholder'")) { input.addClass("'placeholder'"); input.val(input.attr("'placeholder'")); } }).blur(); $("'[placeholder]'").parents("form").submit(function() { $(this).find("'[placeholder]'").each(function() { var input = $(this); if (input.val() == input.attr("'placeholder'")) { input.val("''"); } }) }); //---------------------------
Revision: 54209
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at December 14, 2011 22:19 by mihael
Initial Code
##### HTML ##### <input type="text" value="" placeholder="Write some instructions here" /> ##### jQuery ##### // INPUT PLACEHOLDER //--------------------------- $("'[placeholder]'").focus(function() { var input = $(this); if (input.val() == input.attr("'placeholder'")) { input.val("''"); input.removeClass("'placeholder'"); } }).blur(function() { var input = $(this); if (input.val() == "''" || input.val() == input.attr("'placeholder'")) { input.addClass("'placeholder'"); input.val(input.attr("'placeholder'")); } }).blur(); $("'[placeholder]'").parents("'form'").submit(function() { $(this).find("'[placeholder]'").each(function() { var input = $(this); if (input.val() == input.attr("'placeholder'")) { input.val("''"); } }) }); //---------------------------
Initial URL
Initial Description
jQuery for inputy attribute "placeholder".
Initial Title
jQuery [input] Placeholder
Initial Tags
jquery, html5
Initial Language
jQuery