1. You need to set click events for all images, including the img tag in the html that is added later.
2. How to add click events to all img.
3. Is there a method similar to $().on?
迷茫2017-06-26 10:52:54
var imgs = ..... // 获取你要的img标签
Array.prototype.forEach.call(imgs, function (img) {
img.addEventListener('click', function () {
// do something
})
})
As long as the code is written in js, all native methods can be used.