Home > Web Front-end > JS Tutorial > jquery live() calls non-existent solution_jquery

jquery live() calls non-existent solution_jquery

WBOY
Release: 2016-05-16 16:58:09
Original
846 people have browsed it

In the new version of jquery, the live() method has been deleted, so when we call it, we will be prompted that the function does not exist and js will report an error.

The solution is to use the on() function to replace it.

The original writing is:
jquery live() calls non-existent solution_jquery
If it is directly replaced with the on() method, then the newly generated element Clicking the event again will not have any effect. The new syntax is:
jquery live() calls non-existent solution_jquery
This involves a question, why is $("body") here the body? In fact, we can choose other distances# The node that is closer to company_logo will have better performance. In fact, on() is to find the #company_logo node in the body, so we replace the body with the superior node of #company_logo to achieve better performance.

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template