如何判断网页中引入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可以判断是否引入。


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM