如何判斷網頁中引入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