/ 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
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..."); } });
You need to login to post a comment.
