How does jQuery set up any event handlers that match a selector
Editor to share with you how to set up jQuery to match a selector event handler, I believe that most people do not know much about it, so share this article for your reference, I hope you will learn a lot after reading this article, let's go to know it!
Set up any event handlers that match a selector
$('button.someClass'). Live (' click', someFunction); / / Note that in jQuery 1.4.2, the delegate and undelegate options have been//introduced to replace live as they offer better support for context//For example, in terms of a table where before you would use..// .live () $("table") .each (function () {$("td", this) .live ("hover", function () {$(this) .toggleClass ("hover");}) / / Now use..$ ("table"). Delegate ("td", "hover", function () {$(this) .toggleClass ("hover");}); these are all the contents of the article "how to set up any event handler that matches a selector". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!