jQuery suggestion plugin

Supports server and local serach. Navigation in layer over key-events possible.



1. insert input field
<input type="text" id="search" >

2. add jQuery an the suggest plugin
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script&g
<script src="js/suggest.js"></script>

3. init suggesten
$("#search").suggest({url: "server.php"});
$("#search").suggest({data: ["test1", "test2", "test3"]});


functions can be called after initialization.

$("#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.
© falk-m.de