Home >Web Front-end >JS Tutorial >How to add click event in js
This article will share with you how to append html with js and add click events. I hope the code in this article can help you.
$("#product").on("click", ".items", function () { $.app.product.displayProduct($(this).attr("id"));})
Parent element
"#product"
Child element
.items
The child element is appended to the page through the parent element
Related recommendations:
JS mouse 3 click event implementation code
jQuery custom element right-click event
jQuery triggers by default when running the page for the first time Click event
The above is the detailed content of How to add click event in js. For more information, please follow other related articles on the PHP Chinese website!