%JQREQUIRE{"ui::autocomplete"}%
to make use of the library on a wiki page.
Add the .jqUIAutocomplete
css class to enable autocompletion.
Specify the url to fetch terms in the autocomplete
html attribute.
Add JQueryMetadata to specify further parameters.
When specifying a local data source for autocompletion terms use the source
html5 data as specified in the examples below.
When specifying a remote source in the autocomplete
html attribute, the
additional css class .jqUIAutocomplete
isn't required.
See http://docs.jquery.com/UI/Autocomplete#options for further useful options
that can be specified as html5 data.
%JQREQUIRE{"ui::autocomplete"}% <input type='text' class='jqUIAutocomplete' data-source='["term1", "term2", "..."]' data-delay='500' data-min-length='3' /> <input type='text' autocomplete='http://...url to term backend...' />
label
and an value
property.
Array of strings:
[ "term1", "term2", "..." ]Array of json objects:
[ { label: "display this", value: "value is this", }, { label: "display this", value: "value is this" }, ... ]Custom properties may be specified as part of each json object in the array. Note however to make use of these you will have to initialize autocompletion using javascript and by specifying a renderer for items in the autocompltion dropbox yourself like this:
<input type="text" id="project" /> <input type="hidden" id="project-id"/> <img id="project-icon" src="..." /> <div id="project-description"></div> <literal> <script> var projects = [ { value: "jquery", label: "jQuery", desc: "the write less, do more, JavaScript library", icon: "jquery_32x32.png" }, { value: "jquery-ui", label: "jQuery UI", desc: "the official user interface library for jQuery", icon: "jqueryui_32x32.png" }, { value: "sizzlejs", label: "Sizzle JS", desc: "a pure-JavaScript CSS selector engine", icon: "sizzlejs_32x32.png" } ]; jQuery(function($) { $("#project").autocomplete({ source: projects, select: function( event, ui ) { $("#project").val(ui.item.label); $("#project-id").val(ui.item.value); $("#project-description").html(ui.item.desc); $("#project-icon").attr("src", "images/" + ui.item.icon ); return false; } }).data("ui-autocomplete")._renderItem = function(ul, item) { return $("<li></li>") .data("item.autocomplete", item) .append("<a>" + item.label + "<br>" + item.desc + "</a>") .appendTo( ul ); }; }); </script> </literal>
Topic: | |
---|---|
Country: |
%STARTSECTION{"data"}%<noautolink> %SEARCH{ "^\| [^\*].*%URLPARAM{"term"}%.* \| *$" web="%SYSTEMWEB%" topic="CountryList" type="regex" multiple="on" nonoise="on" casesensitive="off" header="[" format="\"$pattern(.*?\| ([^\|]*) \|.*)\"" separator=", " footer="]" }% </noautolink>%ENDSECTION{"data"}%See http://jqueryui.com/demos/autocomplete/ for more demos.
![]() |
© 2025 D.Soost & D.Marxsen - All rights reserved © Of all articles by authors Trademarks are the property of their respective owners © Logo by Wikipedia, modified by Administrator | Impressum Disclaimer Datenschutzerklärung |