Home > Article > Web Front-end > How to check whether the webpage is loading jquery
How to check whether the webpage is loading jquery: first create a code sample file; then use the statement "if(typeof jQuery != 'undefined'){...}" to determine whether jquery is loaded.
The operating environment of this tutorial: windows7 system, jquery1.7.2&&html5 version, Dell G3 computer.
Recommended: jquery video tutorial
Directly upload the code, if you don’t believe me, test it yourself.
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>jquery</title> </head> <body> <h5>判断jquery是否加载</h5> <script type="text/javascript" src="jquery-1.7.2.min.js"></script> <script type="text/javascript"> if(typeof jQuery != 'undefined') { alert("jquery已经被加载"); } else { alert("jquery没有被加载"); } </script> </body> </html>
Mainly talk about two points:
1. There are pictures and the truth
2. You can determine whether to import it by annotating jquery.
The above is the detailed content of How to check whether the webpage is loading jquery. For more information, please follow other related articles on the PHP Chinese website!