简体   繁体   English

TypeError:undefined不是函数(评估'$(“#typed”)。typed')

[英]TypeError: undefined is not a function (evaluating '$(“#typed”).typed')

I'm using a plugin Typed.js When I initialize the function the error mentioned pops up. 我正在使用插件Typed.js初始化函数时,出现上述错误。 It suggests that the jquery is not loaded before the plugin but I don't see why. 它表明jQuery没有在插件之前加载,但我不明白为什么。

HTML HTML

<script type="text/javascript" src="jquery-2.1.3.min.js"></script>
<script type="text/javascript" src="typed.js"></script>

in the header. 在标题中。

And

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

at the end of the body. 在身体的尽头。

Can anybody find the mistake please? 有人能找到错误吗?

Check your code , having duplicate <script src="js/jquery-2.2.3.min.js"></script> is equal to not including jQuery . 检查您的代码,重复的<script src="js/jquery-2.2.3.min.js"></script>等于不包括jQuery

remove the duplicate ... 删除重复的...

If jQuery wasn't loaded, then it would throw a reference error on $ . 如果未加载jQuery,则会在$上引发引用错误。

It says .typed is undefined so either: 它说.typed是未定义的,所以:

  1. Your URL to src="typed.js" is not returning the script or 您指向src="typed.js" URL未返回脚本
  2. The script doesn't give jQuery objects a typed property 该脚本没有为jQuery对象提供typed属性

Assuming I've found the right script, it definitely isn't option 2: http://jsfiddle.net/1gap1b39/ 假设我找到了正确的脚本,那肯定不是选项2: http//jsfiddle.net/1gap1b39/

Check the Net tab of your developer tools to make sure you are getting a 200 OK response for the script. 检查开发人员工具的“网络”选项卡,以确保脚本得到200 OK响应。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 未捕获的类型错误:$(...).typed 不是函数 - Uncaught TypeError: $(…).typed is not a function TypeError:undefined不是函数(评估调度) - TypeError: undefined is not a function (evaluating dispatch) TypeError:undefined不是一个函数(评估“ categories.map”) - TypeError: undefined is not a function (evaluating 'categories.map') TypeError:未定义不是函数(正在评估userItems.map) - TypeError: undefined is not a function (evaluating userItems.map) TypeError:'undefined'不是函数(评估'mockBackend.expectPost( - TypeError: 'undefined' is not a function (evaluating 'mockBackend.expectPost( TypeError:undefined&#39;不是函数(评估&#39;myAudio.play()&#39;)“ - TypeError: undefined' is not a function (evaluating 'myAudio.play()')" TypeError:undefined不是一个函数(评估&#39;document.getsElementsByClassName(&#39;&#39;) - TypeError: undefined is not a function (evaluating 'document.getsElementsByClassName('') TypeError:'undefined'不是函数(评估'sinon.spy()') - TypeError: 'undefined' is not a function (evaluating 'sinon.spy()') 键入时评估文本字段 - Evaluating text field while being typed TypeError: undefined is not an object(评估“this”) - TypeError: undefined is not an object (evaluating 'this')
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM