set Search Keyword Field


/ Published in: jQuery
Save to your folder(s)



Copy this code and paste it in your HTML
  1. function setSearchKeywordField(selector, string){
  2. var selector = $(selector);
  3. selector.attr({ value: string }).focus(function(){
  4. if ($(this).val() == string) {
  5. $(this).val("");
  6. }
  7. }).blur(function(){
  8. if ($(this).val()=="") {
  9. $(this).val(string);
  10. }
  11. });
  12. }
  13.  
  14. setSearchKeywordField("#header .right form input.textfield", "Search");

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.