Home >Web Front-end >JS Tutorial >How Do I Migrate from jQuery\'s Deprecated `.live()` to the `.on()` Method?
jQuery 1.9 .live() has been removed
In jQuery 1.9 and later, the .live() function has been deprecated and removed. When upgrading from jQuery 1.8 or earlier, you may encounter the error TypeError: $(...).live is not a function.
Migration Guide to Replace .live()
To replace .live(), use the .on() function instead, but note that the parameters are different:
The child selector is crucial. If not needed, set it to null.
Migration Examples
Example 1:
Example 2:
Additional Resources:
The above is the detailed content of How Do I Migrate from jQuery\'s Deprecated `.live()` to the `.on()` Method?. For more information, please follow other related articles on the PHP Chinese website!