设置搜索关键字字段

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了设置搜索关键字字段相关的知识,希望对你有一定的参考价值。

  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");

以上是关于设置搜索关键字字段的主要内容,如果未能解决你的问题,请参考以下文章