$("#s") .val("Search...") .css("color", "#ccc") .focus(function(){ $(this).css("color", "black"); if ($(this).val() == "Search...") { $(this).val(""); } }) .blur(function(){ $(this).css("color", "#ccc"); if ($(this).val() == "") { $(this).val("Search..."); } });
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter