Revision: 23907
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at February 16, 2010 15:46 by vagrantradio
Initial Code
$(document).ready(function() { //attach function to input and make text grayed out on page load textReplacement($('#query').css("color", "#999")); }); // the function: function textReplacement(input){ //input focus text function var originalvalue = input.val(); input.focus( function(){ if( $.trim(input.val()) == originalvalue ){ input.val('').css("color", "#000"); } }); input.blur( function(){ if( $.trim(input.val()) == '' ){ input.val(originalvalue).css("color", "#999"); } }); }
Initial URL
Initial Description
Clears input or search field on focus.
Initial Title
CLEAR INPUT ON FOCUS FUNCTION
Initial Tags
search
Initial Language
jQuery