[英]TypeError: undefined is not a function (evaluating '$(“#typed”).typed')
我正在使用插件Typed.js初始化函數時,出現上述錯誤。 它表明jQuery沒有在插件之前加載,但我不明白為什么。
HTML
<script type="text/javascript" src="jquery-2.1.3.min.js"></script>
<script type="text/javascript" src="typed.js"></script>
在標題中。
和
<script>
function type(){
$("#type").typed({
strings: ["^1000to the biggest student organised fest in Kanpur", "to the biggest student organised fest in UP", "to the biggest student organised fest in <span style='color: #ffee00'>India</span> ^800."],
typeSpeed: 10,
stringstops: [41, 41, 41],
backDelay: 600,
showCursor: true,
loop: false,
contentType: 'html', // or text
// defaults to false for infinite loop
loopCount: false,
});
}
window.onload=type;
</script>
在身體的盡頭。
有人能找到錯誤嗎?
檢查您的代碼,重復的<script src="js/jquery-2.2.3.min.js"></script>
等於不包括jQuery 。
刪除重復的...
如果未加載jQuery,則會在$
上引發引用錯誤。
它說.typed
是未定義的,所以:
src="typed.js"
URL未返回腳本或 typed
屬性 假設我找到了正確的腳本,那肯定不是選項2: http : //jsfiddle.net/1gap1b39/
檢查開發人員工具的“網絡”選項卡,以確保腳本得到200 OK
響應。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.