Home > Web Front-end > JS Tutorial > The problem of invalid id binding event in jquery appaend element

The problem of invalid id binding event in jquery appaend element

一个新手
Release: 2017-09-30 09:52:46
Original
1064 people have browsed it

1. In the append element in jquery, if the element has an id value and is bound to an event, the id event will be invalid and must be refreshed before it can be used.

2. Solution:

Example: If in a

, add a button with id="demo" through append , the commonly used direct

$("Selector").on("eventType",function(){})
Copy after login

listening event function does not work. For example, the click listening event of the button should be written like this:

$(".title").on("click","#demo",function(){});
Copy after login

The above is the detailed content of The problem of invalid id binding event in jquery appaend element. For more information, please follow other related articles on the PHP Chinese website!

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