Differential Analysis of live of Method and bind of Method in jquery

  • 2021-06-29 09:59:52
  • OfStack

This paper describes the differences between live () and bind () methods in jquery.Share it for your reference, as follows:

live() is not affected by the loading time sequence, as long as it finds a pair it can bind the corresponding event, while the bind method only binds the time when it is first loaded, and if the paired element is loaded after the code, it cannot bind the corresponding event


$("#manual_disconnect").live("click", function(){
  connectionProfile("0");
});
$("#manual_disconnect").die("click");

Note: The die () method is the method to unbind live


$("#manual_disconnect").live("click", function(){
  connectionProfile("0");
});
$("#manual_disconnect").unbind("click");

Note: The unbind () method is the method to unbind live

More readers interested in jQuery-related content can view this site's topics: jQuery Operation DOM Node Method Summary, jQuery Extended Skills Summary, jQuery Common Plug-ins and Usages Summary, jQuery Dragging Special Effects and Skills Summary, jQuery Table (table) Operation Skills Summary, Ajax Usage Summary in jquery, andSummary of jQuery Common Classic Special Effects, Summary of jQuery Animation and Utility, and Summary of jquery Selector Usage

I hope that the description in this paper will be helpful to everyone's jQuery program design.


Related articles: