DIV CSS 佈局教程網

jQuery Autocomplete 自動完成
編輯:JQuery常見問題     

Autocomplete 是常見的自動完成外掛,可在使用者輸入時提供建議清單,常用於搜尋框、名稱選擇與快速填入。

基本初始化

$("#txtSelectName").autocomplete(objects, {
  minChars: 0,
  max: 5,
  autoFill: true,
  mustMatch: false,
  matchContains: true,
  scrollHeight: 200,
  formatItem: function (row) { return row.name; },
  formatResult: function (row) { return row.value; }
});

資料來源

除了 JSON 物件陣列,也可使用 JavaScript 陣列或遠端資料。常見參數包含 minChars、max、delay、autoFill、mustMatch、matchContains、cacheLength 等,可依需求調整提示行為。

XML學習教程| jQuery入門知識| AJAX入門| Dreamweaver教程| Fireworks入門知識| SEO技巧| SEO優化集錦|
Copyright © DIV+CSS佈局教程網 All Rights Reserved