Today I encountered a problem when writing JQUERY: when using a script to dynamically add element xxx, the event $(".x .y").click(function)... failed.
I just found the live function online. The method is as follows:
Event binding: $(".x .y").click(function) needs to be changed to:
$(".x .y").live('click', function);
However, since the live method is no longer supported after version 1.8, you need to use the following on method in jquery to solve the problem of dynamically adding elements in scripts:
$(".y").on('click','.x',function);
Statement: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