/ Published in: jQuery
add a value to your text input e.g. "Enter keywords" and clear on-click
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
autoFill($("targetElement"), "content"); //auto fill search field function autoFill(id, v){ $(id).attr({ value: v }).focus(function(){ if($(this).val()==v){ $(this).val("").css({ color: "#333" }); } }).blur(function(){ if($(this).val()==""){ $(this).val(v); } }); }