Home >Web Front-end >JS Tutorial >Example of usage of live() method in jQuery_jquery

Example of usage of live() method in jQuery_jquery

WBOY
WBOYOriginal
2016-05-16 16:19:241041browse

The example in this article describes the usage of the live() method in jQuery. Share it with everyone for your reference. The specific analysis is as follows:

This method adds one or more events to the matching element and specifies a function to run when these events occur.
Special note: jQuery1.9 has deleted this method.

Grammar structure:

Copy code The code is as follows:
$(selector).live(type,data,function)

Parameter list:

Parameter
参数 描述
type 定义附加到元素的一个或多个事件类型。由空格分隔多个事件值。
data 可选。定义传递到事件处理函数的额外数据。
Description
type Define one or more event types attached to the element. Multiple event values ​​separated by spaces.
data Optional. Defines additional data passed to the event handler function.
function 定义当事件发生时运行的函数。

Example code:

Copy code The code is as follows:






Script Home







  • Click here to test it





The above code registers the click event handler for the li element.

I hope this article will be helpful to everyone’s jQuery programming.

Statement:
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