This article mainly introduces three methods for binding jQuery events, namely on (), bind (), and delegate (), which are very easy to understand. For more information, see. After a few days of js-related learning, some people use bind (), some use on (), some use delegate (), some people also use live (). When reading the code, they thought that all the functions were implemented, but they didn't fully understand the differences. So today, I checked the information and made a summary.
The reason why there are so many types of binding methods is that jQuery versions are updated. For example, the on () method will appear after 1.7.
On the jQuery event binding api page, the live () method is outdated and is not recommended. So here we mainly look at the following three methods: bind (), delegate (), on ()
We prepare an html page for testing various types of event binding.