jQuery3.0+报错Uncaught TypeError: e.indexOf is not a function

2023-05-25,,

jQuery3.0+报错Uncaught TypeError: e.indexOf is not a function
使用.load()绑定事件时报错,Uncaught TypeError: e.indexOf is not a function
显示出错的代码为$('#id').load(function () {}
因为 .load() 在 jQuery1.8 时不建议使用,在 jQuery3.0 时弃用
使用 $('#id').on('load', function() {}) 代替即可


同时在3.0+被弃用的还有:

.error() :使用.on( "error", handle)代替
.unload() :使用.on( "unload", handle)代替


在3.0+不建议使用的有:

.bind().unbind().delegate().undelegate()
使用 .on().off() 代替

jQuery3.0+报错Uncaught TypeError: e.indexOf is not a function的相关教程结束。

《jQuery3.0+报错Uncaught TypeError: e.indexOf is not a function.doc》

下载本文的Word格式文档,以方便收藏与打印。