/ Published in: jQuery
Display a default value in a text field that disappears on focus and reappears on blur **if** the field is blank.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
if($(input).val() == ""){ $(input).val("Search Here..."); } $(input).focus(function(){ if($(input).val() == "Search Here..."){ $(this).val(""); } }); $(input).blur(function(){ if($(input).val() == ""){ $(input).val("Search Here..."); } });