The problem is: with jquery append (or before, after, and so on) newly added elements of the page, the usual events can not be triggered, such as: Append the ID of the element ABC, then $ (#abc). Click (function () {}) is not effective.
1. Online said to use the live () function, the pro-test invalid, should be the version of jquery, anyway, so far is not used;
2. Workaround: Use the on function, to pay attention to the format (landlord engaged in a half-day, because the format is not right, hey, don't say ...) It's all tears)
correct format: $ (" Outerselector "). On (' EventType ', ' selector ', function () {});
Outerselector is a DOM that always exists, selector is the node you want to listen to click,
example: $ (function () {
$ ("form"). On (' click ', "[class= ' image ']", function () {
this.remove ();
})
})
Suddenly found all kinds of knowledge deep like the sea AH to study hard
Append append element Binding event Invalid workaround