如何判断网页中引入jquery

直接上代码,不信自己测。

<html xmlns="http://www.w3.org/1999/xhtml">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<head>
<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>

主要讲两点:

1.有图有真相

2.通过注释jquery可以判断是否引入。

posted @ 2016-10-09 10:59  呦呦呦呦呦呦呦呦  阅读(2836)  评论(0编辑  收藏  举报