In the append element in jquery, if there is an id value in the element and the event is bound, the id event will be invalid and must be refreshed before it can be used. This article mainly brings you an article to solve the problem of invalid id binding event in jquery appaend element. The editor thinks it’s pretty good, so I’ll share it with you now and give it as a reference. Let’s follow the editor to take a look, I hope it can help everyone.
Solution:
Example: If in a
, add a button with id="demo" through append, commonly used The direct $("Selector").on("eventType",function(){}) 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(){});
Related recommendations:
Detailed explanation of the problem of JQuery binding events in the loop
Detailed explanation of Cpage.js binding event instances to components
javascript uses event attributes to bind event functions in detail
The above is the detailed content of Solution to the invalid id binding event in jquery appaend element. For more information, please follow other related articles on the PHP Chinese website!