Home > Web Front-end > JS Tutorial > body text

Jquery AutoComplete automatic completion usage example_jquery

WBOY
Release: 2016-05-16 18:31:51
Original
901 people have browsed it

jquery-autocomplete配置:




首先是一个最简单的Autocomplete(自动完成)代码片段:

复制代码 代码如下:



AutoComplate















result方法是jQuery Autocomplete插件里的重要方法,它在用户在选定了某个条目时触发。data参数为选中的数据。

一个稍微复杂的例子,可以自定义提示列表:
复制代码 代码如下:



自定义提示















formatItem, formatMatch, and formatResult are the keys to customizing prompt information.
The function of formatItem is to format the items in the list. For example, we add "I" to make the words in the list appear in italics.
formatMatch is used in conjunction with formatItem. The function is that due to the use of formatItem, the content in the entry has changed, and what we want to match is the original data, so we use formatMatch to make an adjustment to match the original data.
formatResult defines the final returned data. For example, we still need to return the original data, not the formatItem data.

jquery bassistance.de AutoComplete automatic completion effect codeDownload
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!