Cannot read property 'substr' of undefined?

网站使用typed.js打字特效,出现一下问题

报错信息:

(index):473 [span#typed]0: span#typedlength: 1__proto__: Array(0)
(index):474 [div#typed-strings]

typed.js@2.0.12:10 Uncaught TypeError: Cannot read property 'substr' of undefined
    at t.value (typed.js@2.0.12:10)
    at typed.js@2.0.12:10

HTML:

<div class="type-wrap">
      <div id="typed-strings" style="display: none"></div>

      <span id="typed"></span>
</div>

script代码:

    // 动态打字效果
    console.log(jQuery.find("#typed"))
    console.log(jQuery.find("#typed-strings"))
    var typed = new Typed('#typed', {
        stringsElement: document.getElementById("typed"),
        typeSpeed: 100, //打字速度
        startDelay: 1000,//开始之前的延迟1000毫秒
        //用淡出代替退格(必须使用CSS类)
        fadeOut: true,
        fadeOutClass: 'typed-fade-out',
        fadeOutSpeed: 3000, //衰减速度:500,//毫秒
        loop: true,// 开启循环
        loopCount: null, // 循环次数 null为无限
     })

 

这个问题如何解决?时不时的给我来一下,就是找不出病根。。。

 

偶尔报错吗?可能这个typed.js不稳定。

您好,我是有问必答小助手,您的问题已经有小伙伴解答了,您看下是否解决,可以追评进行沟通哦~

如果有您比较满意的答案 / 帮您提供解决思路的答案,可以点击【采纳】按钮,给回答的小伙伴一些鼓励哦~~

ps:问答VIP仅需29元,即可享受5次/月 有问必答服务,了解详情>>>https://vip.csdn.net/askvip?utm_source=1146287632