Home > Web Front-end > JS Tutorial > Precautions for using jquery's live_jquery

Precautions for using jquery's live_jquery

WBOY
Release: 2016-05-16 16:59:31
Original
1164 people have browsed it

-------------------------- Title

Recently, I encountered a very strange problem in development. When a button is clicked to submit, multiple errors occur. requests, resulting in data duplication.

Then, after debugging, it was found that the cause of the problem is $("#id").live("click", function() {}); in this live, if you use bind, it may not be achieved Requirement, because if the returned request after an asynchronous request is html instead of json, the bind component may fail when the page is refreshed using html.

-------------------------- Solution

So, in the end, it can only be on the html tag element Add onclick attribute to solve it.

This not only solves the problem of asynchronous return of html format, but also solves the problem of multiple requests on one click caused by multiple bindings caused by multiple html() refreshes of the page (including the js part). bug.

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