Home  >  Article  >  Web Front-end  >  How to check whether the webpage is loading jquery

How to check whether the webpage is loading jquery

藏色散人
藏色散人Original
2020-12-25 09:34:422451browse

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.

How to check whether the webpage is loading jquery

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 != &#39;undefined&#39;) {
alert("jquery已经被加载");
} else {
alert("jquery没有被加载");
}
</script>
</body>
</html>

Mainly talk about two points:

1. There are pictures and the truth

How to check whether the webpage is loading jquery

How to check whether the webpage is loading jquery

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!

Statement:
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