鉴于网上关于indexOf is not a function解决方法都是jQuery解决方案,跟遇到问题不是一回事写下解决方案。

错误输出:XXX.indexOf is not a function 问题

错误代码:XXX.indexOf is not a function 问题

错误原因:reason2ndIds只有一个id例如100102时,不是字符串,无法使用字符串查找方法indexOf方法。

解决方法:把需要进行查找的字段强转成字符串,强转方法很多,用的是+"";XXX.indexOf is not a function 问题

总结:indexOf为字符串使用方法,确保使用的字段为字符串。

相关文章:

  • 2021-12-12
  • 2021-09-06
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-08-10
  • 2021-11-07
  • 2021-11-13
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-07-08
  • 2021-07-15
  • 2021-08-12
相关资源
相似解决方案