Revision: 29461
Updated Code
at March 14, 2013 23:11 by cryothic
Updated Code
<input type="text" value="Name" rel="Name" class="replace" /> $(".replace") .focus(function(){ if ($(this).val() === $(this).attr("rel")) { $(this).val("").css("color", "#000000"); } }) .blur(function(){ if ($(this).val() === "") { $(this).val($(this).attr("rel")).css("color", "#5e6a72"); } });
Revision: 29460
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at July 29, 2010 22:57 by cryothic
Initial Code
<input type="text" value="Name" rel="Name" /> $(".replace") .focus(function(){ if ($(this).val() === $(this).attr("rel")) { $(this).val("").css("color", "#000000"); } }) .blur(function(){ if ($(this).val() === "") { $(this).val($(this).attr("rel")).css("color", "#5e6a72"); } });
Initial URL
Initial Description
Replaces the pre-defined text of a textbox (e.g. the purpose of the textbox) when the textbox gets focussed, and resets the text if it blurs when empty
Initial Title
Textbox inside-label replace
Initial Tags
replace
Initial Language
jQuery