Home > Article > Web Front-end > First introduction to Jquery and its usage
1. Several disadvantages of js:
1. There can only be one entry function for js, and the latter one will overwrite the previous one, and it will only be executed after all the resources on the page have been loaded. J
2. It’s troublesome to find the object, the method is single
3. Manually write the for loop
4. There are compatibility issues with native js
5. The code The fault tolerance rate is not high. Once an error is reported, it will not be executed later
6. It is troublesome to implement animation with js. Manual encapsulation
1、引包 script src ="jquery-1.12.4.js" 2、入口函数($()===jQuery(),$是jQuery的一个简写形式 简写:$(function(){ }); $(document).ready(function(){//等待dom元素加载完毕 alert('Hello World!');//弹出警告框 };is similar to window.onload, but window.load must wait It can only be executed after all the content of the web page (including pictures) has been loaded, and multiple executions cannot be performed. The latter covers the former*tips:The essence of $, $(); function callparameters , you can use three types1)func;2)Function name3)String: "p";
The above is the detailed content of First introduction to Jquery and its usage. For more information, please follow other related articles on the PHP Chinese website!