Posted By

joe-bbb on 10/30/09


Tagged

search input


Versions (?)

set Search Keyword Field


 / Published in: jQuery
 

  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  

You need to login to post a comment.