Home >Web Front-end >JS Tutorial >How to add click event in js

How to add click event in js

小云云
小云云Original
2018-02-26 14:24:273615browse

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!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn