Home > Web Front-end > JS Tutorial > body text

What is the difference between JQuery click() and onclick()

coldplay.xixi
Release: 2020-12-22 16:56:11
Original
10600 people have browsed it

The difference between JQuery click() and onclick(): 1. onclick is a binding event, telling the browser what to do when the mouse clicks; 2. The main function of the click method is to trigger the onclick event of the element that calls the click method. .

What is the difference between JQuery click() and onclick()

The operating environment of this tutorial: Windows 7 system, jquery version 1.10.0. This method is suitable for all brands of computers.

The difference between JQuery click() and onclick():

1. onclick is a binding event that tells the browser what to do when the mouse clicks

2. The main function of the click() method is to trigger the onclick event of the element that calls the click method.

3. When click() is clicked, the onclick() function of the corresponding element is first executed, and then click(). The example is as follows:

JS code test.js:

$("#testclick").click(function(){
     console.log("$(\"#testclick\").click"); 
 }); 
function test123(){ 
  console.log("function test()"); 
}
Copy after login
rrree

Related learning recommendations: javascript video tutorial

The above is the detailed content of What is the difference between JQuery click() and onclick(). 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
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!