Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use live in jquery

2025-01-31 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

Most people do not understand the knowledge points of this article "how to use live in jquery", so the editor summarizes the following content, detailed content, clear steps, and has a certain reference value. I hope you can get something after reading this article. Let's take a look at this "how to use live in jquery" article.

In jquery, the live () method is used to add an event handler to the element and specifies the function to run when the event occurs, with the syntax of "$(selector) .live (event,data, the function that runs)"; this method has been removed in jquery version 1.9 and can be replaced by the on () method.

The operating environment of this tutorial: windows10 system, jquery3.2.1 version, Dell G3 computer.

The usage of live in jquery

The live () method appends one or more event handlers to the selected element and specifies the function to run when these events occur.

Event handlers attached through the live () method are suitable for matching current and future elements of the selector (such as new elements created by scripts).

Grammar

$(selector) .live (event,data,function)

The parameters are expressed as follows:

Event is required. Specifies one or more events attached to the element. Multiple events are separated by spaces. Must be a valid event.

Data is optional. Specifies the additional data passed to the function.

Function is required. Specifies the function to run when an event occurs.

The live () method is deprecated in jQuery version 1.7 and removed in version 1.9. Use the on () method instead.

Examples are as follows:

$(document) .ready (function () {$("button") .live ("click", function () {$("p") .slideToggle ();})

This is a paragraph.

Please click here above is the content of this article on "how to use live in jquery". I believe you all have some understanding. I hope the content shared by the editor will be helpful to you. If you want to know more about the relevant knowledge, please follow the industry information channel.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report