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

How to add click event in js

小云云
Release: 2018-02-26 14:24:27
Original
3596 people have browsed it

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"));})
Copy after login

Parent element

"#product"
Copy after login

Child element

.items
Copy after login

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!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template