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. .
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()"); }
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!