Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
424 views
in Technique[技术] by (71.8m points)

javascript - 打开新的基础项目时出现“ Uncaught TypeError:a.indexOf不是函数”错误(“Uncaught TypeError: a.indexOf is not a function” error when opening new foundation project)

I've created a new Foundation 5 project through bash, with foundation new my-project .(我已经通过bash创建了一个新的Foundation 5项目,其中包括了foundation new my-project 。)

When I open the index.html file in Chrome an Uncaught TypeError: a.indexOf is not a function error is shown in the console, originating in jquery.min.js:4 .(当我在Chrome中打开index.html文件时,控制台中显示Uncaught TypeError: a.indexOf is not a function错误,起源于jquery.min.js:4 。) I created the project following the steps on the foundation site, but I can't seem to get rid of this error.(我按照基础站点上的步骤创建了项目,但似乎无法摆脱此错误。) Foundation and jQuery look like they are included and linked up correctly in the index.html file, and the linked app.js file is including $(document).foundation();(Foundation和jQuery看起来像它们都包含在index.html文件中并正确链接,而链接的app.js文件包含$(document).foundation();) Does anyone know what is causing this error?(有谁知道是什么原因导致此错误?) and what a solution might be?(有什么解决方案?) 控制台错误消息截图   ask by FreddieE translate from so

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

This error might be caused by the jQuery event-aliases like .load() , .unload() or .error() that all are deprecated since jQuery 1.8 .(这种错误可能是由jQuery的事件别名等引起.load() .unload().error()所有弃用 ,因为jQuery的1.8 。)

Lookup for these aliases in your code and replace them with the .on() method instead.(在代码中查找这些别名,然后将其替换为.on()方法。) For example, replace the following deprecated excerpt:(例如,替换以下不推荐使用的摘录:) $(window).load(function(){...}); with the following:(具有以下内容:) $(window).on('load', function(){ ...});

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

1.4m articles

1.4m replys

5 comments

57.0k users

...