The solution of Jquery binding the Click event to the newly inserted node is invalid. jqueryclick
1. Some people say that Live is used. In fact, the latest Jquery does not support Live anymore. The solution to live is as follows:
You can read this or not, but you can do it by knowing what you want. The following describes the ON method.
Live: Introduction to Live
2. Some people use ON to solve the problem. This solution is basically correct.
On: On Introduction, can solve the problem
The On method can basically solve the problem, but you should also make a choice based On your specific situation. Not everyone's code is as simple as described in the above case. However, the case changes.
I did this and finally solved the problem.
I have a UL label that is static, that is, it was not dynamically added later.
Then I added images dynamically.
<Li> <a href = "#"...> link </a> </li>.
I chose the method below.
$ ("# Subul "). on ('click', 'Li> A', function (e) {// cancel bubbling // var e = e | window. event; // e. stopPropagation (); alert ("asssss"); var areaid = this. attributes. getNamedItem ("id "). nodeValue; alert (areaid); $ ("# subul> li> "). removeClass ("smallBtSelected"); $ ("#" + areaid ). addClass ("smallBtSelected ");})
The above Jquery solution to binding the Click event to the newly inserted node is to share all the content with you in the editor. I hope to give you a reference, and I hope you can also provide more support to the customer center.