Supports server and local serach. Navigation in layer over key-events possible.
<input type="text" id="search" >
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script&g
<script src="js/suggest.js"></script>
$("#search").suggest({url: "server.php"});
//or
$("#search").suggest({data: ["test1", "test2", "test3"]});
functions can be called after initialization.
$("#search").suggest("disable");
$("#search").suggest("enable");
$("#search").suggest("option", "data", ["test1", "test2", "test3"]);
options can be set by the "option" function or by initialization.
url | (default: '') If set, then hte suggest layer call this url to get data from server. The url is query by Post-request with a "search"-parameter. The response must be a json-array. |
url_data | (default: {}). A Objekt of propertys, they send to server by the request. |
data | (default: []) A array of strings to search suggestion-data local. if a "url" is set, "data" are ignored. |
minLetter | (default: 1) Minimum count of input before search start. |
maxDisplay | (default: 10) Maximum items in suggesteion-Layer |
layerTemplate | (default: <ul class="suggest"></ul>) The template fpr the suggestion-Layer |
itemTemplate | (default: <li></li>) The template for the items in the layer. |
itemActiveClass | (default: "hover") The css class vor the active Layer item. |
searchWait | (default: 200) The miliseconts to wait, before search start. |