博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
jqueryui时间插件_jQueryUI AutoComplete插件
阅读量:2533 次
发布时间:2019-05-11

本文共 8634 字,大约阅读时间需要 28 分钟。

jqueryui时间插件

In this post, we will discuss about one of the useful plugins provided by jQuery to speed up the user interactions in your application, the Autocomplete plugin.

在本文中,我们将讨论jQuery提供的用于加速应用程序中用户交互的有用插件之一,即Autocomplete插件。

You can easily integrate the Autocomplete plugin in your application. This enables the users to easily search and filter items from an already populated list of items as they type on any input fields.

您可以轻松地将Autocomplete插件集成到您的应用程序中。 这样,用户在任何输入字段上键入内容时,都可以轻松地从已经填充的项目列表中搜索和过滤项目。

内容 (Contents)

jQueryUI自动完成插件选项 (jQueryUI Autocomplete Plugin Options)

In this section, we will discuss about different options available to customize the jQueryUI Autocomplete plugin. We have used many of these options in the section.

在本节中,我们将讨论可用于自定义jQueryUI自动完成插件的不同选项。 我们在“ 部分中使用了许多这些选项。

Options Syntax Description
appendTo $( “.selector” ).autocomplete({ appendTo: “#someElement” }); Used to append an element to the menu.
autoFocus $( “.selector” ).autocomplete({ autoFocus: true }); First item in the menu will be automatically focused if it is set to true.
delay $( “.selector” ).autocomplete({ delay: 400 }); An integer value in milliseconds which denotes the time wait before finding the matching values.
disabled $( “.selector” ).autocomplete({ disabled: true }); Setting to true will disable the autocomplete.
minLength $( “.selector” ).autocomplete({ minLength: 0 }); An integer value representing the number of characters to type before finding the matching values.
position $( “.selector” ).autocomplete({ position: { my : “right top”, at: “right bottom” } }); This option is used to identify the position of autocomplete suggestions menu in relation to the associated input field.
source $( “.selector” ).autocomplete({ source: [some array] }); This option must be specified which defines the data to use for the autocomplete menu.
选件 句法 描述
appendTo $(“ .selector”).autocomplete({appendTo:“ #someElement”}); 用于将元素添加到菜单。
自动对焦 $(“ .selector”).autocomplete({autoFocus:true}); 如果设置为true,则菜单中的第一项将自动聚焦。
延迟 $(“ .selector”).autocomplete({delay:400}); 以毫秒为单位的整数值,表示找到匹配值之前的等待时间。
残障人士 $(“ .selector”).autocomplete({disable:true}); 设置为true将禁用自动完成功能。
minLength $(“ .selector”).autocomplete({minLength:0}); 一个整数值,表示找到匹配值之前要键入的字符数。
位置 $(“ .selector”).autocomplete({position:{my:“ right top”,at:“ right bottom”}}); 此选项用于标识自动完成建议菜单相对于关联的输入字段的位置。
资源 $(“ .selector”).autocomplete({来源:[some array]}); 必须指定此选项,该选项定义用于自动完成菜单的数据。

The above table briefly describes the different options in Autocomplete plugin and its syntax.

上表简要描述了自动完成插件中的不同选项及其语法。

jQueryUI自动完成插件方法 (jQueryUI Autocomplete Plugin Methods)

In this section, we will look into the jQueryUI Autocomplete plugin methods and its syntax. These methods are very useful when you deal with the Autocomplete plugin.

在本节中,我们将研究jQueryUI Autocomplete插件方法及其语法。 当您处理自动完成插件时,这些方法非常有用。

Methods Usage Description
close() $( “.selector” ).autocomplete( “close” ); This method is used to close the autocomplete menu.
destroy() $( “.selector” ).autocomplete( “destroy” ); This method will completely remove the autocomplete functionality.
disable() $( “.selector” ).autocomplete( “disable” ); This method is used to disable the autocomplete functionality.
enable() $( “.selector” ).autocomplete( “enable” ); This method enables the autocomplete functionality.
instance() $( “.selector” ).autocomplete( “instance” ); This method is used to get the autocomplete’s instance object
option( optionName, value ) $( “.selector” ).autocomplete( “option”, “disabled”, true ); This method is used to set the value of the autocomplete option associated with the optionName.
search(,[value ] ) $( “.selector” ).autocomplete( “search”, “” ); Triggers the search event using the input value.
widget() $( “.selector” ).autocomplete( “widget” ); This method will return a jQuery object which contains the autocomplete menu element.
方法 用法 描述
关() $(“ .selector”).autocomplete(“ close”); 此方法用于关闭自动完成菜单。
破坏() $(“ .selector”).autocomplete(“ destroy”); 此方法将完全删除自动完成功能。
disable() $(“ .selector”).autocomplete(“禁用”); 此方法用于禁用自动完成功能。
enable() $(“ .selector”).autocomplete(“启用”); 此方法启用自动完成功能。
instance() $(“ .selector”).autocomplete(“ instance”); 此方法用于获取自动完成的实例对象
option(optionName,value) $(“ .selector”).autocomplete(“ option”,“ disabled”,true); 此方法用于设置与optionName关联的自动完成选项的值。
搜索(,[值]) $(“ .selector”).autocomplete(“ search”,“”); 使用输入值触发搜索事件。
小部件() $(“ .selector”).autocomplete(“ widget”); 此方法将返回一个包含自动完成菜单元素的jQuery对象。

This table briefly describes the methods used to customize the autocomplete plugin.

下表简要介绍了用于自定义自动完成插件的方法。

jQueryUI自动完成插件事件 (jQueryUI Autocomplete Plugin Events)

In this section, we will discuss about different events associated with jQueryUI Autocomplete plugin.

在本节中,我们将讨论与jQueryUI Autocomplete插件相关的不同事件。

Methods Usage Description
change( event, ui ) $( “.selector” ).autocomplete({,change: function( event, ui ) {}}); This event is fired when the value is changed and executes the callback function.
close( event, ui ) $( “.selector” ).autocomplete({,close: function( event, ui ) {}}); This is fired when the autocomplete menu is closed or hidden.
create( event, ui ) $( “.selector” ).autocomplete({,create: function( event, ui ) {}}); This is fired on creation of the autocomplete.
focus( event, ui ) $( “.selector” ).autocomplete({,focus: function( event, ui ) {}}); This is fired when an item in the menu is focused.
open( event, ui ) $( “.selector” ).autocomplete({,open: function( event, ui ) {}}); This is fired when the autocomplete option is opened or updated with matching values.
response( event, ui ) $( “.selector” ).autocomplete({,response: function( event, ui ) {}}); This event is fired after completing search operation.
search( event, ui ) $( “.selector” ).autocomplete({,search: function( event, ui ) {}}); This events fires before starting the search operation.
select( event, ui ) $( “.selector” ).autocomplete({,select: function( event, ui ) {}}); This event is fired when an item in the menu is selected.
方法 用法 描述
更改(事件,用户界面) $(“ .selector”).autocomplete({,change:function(event,ui){}}); 更改值并执行回调函数时将触发此事件。
close(event,ui) $(“ .selector”).autocomplete({,close:function(event,ui){}}); 关闭或隐藏自动完成菜单时会触发此事件。
create(event,ui) $(“ .selector”).autocomplete({,create:function(event,ui){}}); 这是在创建自动完成功能时触发的。
焦点(事件,用户界面) $(“ .selector”).autocomplete({,focus:function(event,ui){}}); 当菜单中的某个项目被聚焦时会触发该事件。
打开(事件,用户界面) $(“ .selector”).autocomplete({,open:function(event,ui){}}); 当自动完成选项打开或使用匹配值更新时,将触发此事件。
响应(事件,用户界面) $(“ .selector”).autocomplete({,response:function(event,ui){}}); 搜索操作完成后会触发此事件。
搜索(事件,用户界面) $(“ .selector”).autocomplete({,search:function(event,ui){}}); 在开始搜索操作之前会触发此事件。
select(event,ui) $(“ .selector”).autocomplete({,select:function(event,ui){}}); 选择菜单中的一个项目时会触发此事件。

The above table briefly describes the events associated with the autocomplete plugin.

上表简要描述了与自动完成插件相关的事件。

jQueryUI自动完成插件在行动 (jQueryUI Autocomplete Plugin in Action)

In this section, we will try different examples to explore the uses of jQueryUI Autocomplete plugin.

在本节中,我们将尝试不同的示例来探索jQueryUI Autocomplete插件的用法。

默认功能 (Default Functionality)

The following example demonstrates the default functionality of the Autocomplete plugin. You will find suggestions as you start typing on the input field.

以下示例演示了自动完成插件的默认功能。 在输入字段开始输入时,您会找到建议。

autocomplete-default.html

autocomplete-default.html

         jQueryUI Autocomplete - Default Functionality      

You can see this feature in action as you type on the input field shown below.

在下面显示的输入字段上键入时,您可以看到此功能的运行情况。

使用头寸期权 (Use of position Option)

The following example demonstrates the use of position option in the autocomplete plugin. In this example, you can see how position option is used to customize the autocomplete menu.

以下示例演示了自动完成插件中position选项的使用。 在此示例中,您可以看到如何使用position选项自定义自动完成菜单。

autocomplete-position.html

autocomplete-position.html

         jQueryUI Autocomplete - Default Functionality      

You can see this feature in action as you type on the input field shown below. You may have noticed the change in position of the autocomplete menu in this demo.

在下面显示的输入字段上键入时,您可以看到此功能的运行情况。 您可能已经注意到此演示中自动完成菜单的位置发生了变化。

I hope you understood the basic usage of the autocomplete plugin. You can try using the available options, methods and events to customize the autocomplete plugin.

我希望您了解自动完成插件的基本用法。 您可以尝试使用可用的选项,方法和事件来自定义自动完成插件。

That’s all for now and we will see some more jQuery plugins in the coming posts.

到此为止,我们将在接下来的文章中看到更多的jQuery插件。

翻译自:

jqueryui时间插件

转载地址:http://lclzd.baihongyu.com/

你可能感兴趣的文章
自定义滚动条
查看>>
APP开发手记01(app与web的困惑)
查看>>
笛卡尔遗传规划Cartesian Genetic Programming (CGP)简单理解(1)
查看>>
mysql 日期时间运算函数(转)
查看>>
初识前端作业1
查看>>
ffmpeg格式转换命令
查看>>
万方数据知识平台 TFHpple +Xpath解析
查看>>
Hive实现oracle的Minus函数
查看>>
秒杀多线程第四篇 一个经典的多线程同步问题
查看>>
RocketMQ配置
查看>>
vs code调试console程序报错--preLaunchTask“build”
查看>>
蚂蚁金服井贤栋:用技术联手金融机构,形成服务小微的生态合力
查看>>
端口号大全
查看>>
机器学习基石笔记2——在何时可以使用机器学习(2)
查看>>
POJ 3740 Easy Finding (DLX模板)
查看>>
MySQL 处理重复数据
查看>>
关于typedef的用法总结(转)
查看>>
【strtok()】——分割字符串
查看>>
Linux下安装rabbitmq
查看>>
曹德旺
查看>>