我正在尝试运行基础自定义表单 javascript,但不断遇到类型错误。错误是
forms could not be initialized; TypeError Cannot call method 'indexOf' of undefined"
我似乎无法弄清楚为什么会引发此错误。看来这一段代码就是罪魁祸首
return arr.indexOf(item) === idx; around line 272
当 arr 对象尝试运行此代码时,其值为 null。不确定这是否是由于脚本早期出现其他问题或其他原因造成的。任何帮助将不胜感激。
最佳答案
the arr object is null when it attempts to run this code
这正是错误所提示的。
您需要修复代码以确保 arr
不为 null,或者避免在它为 null 时使用它。
关于javascript - 在基础中使表单 javascript 工作时遇到问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17812796/