大佬教程收集整理的这篇文章主要介绍了jquery – Uncaught TypeError:Object [object Object]没有方法“on”,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
当我使用最新的(或一个新的)版本的jQuery,下面的小脚本工作正常。但是,当我使用旧版本的jQuery,我的脚本说,on函数不存在。
这里是我的脚本,不工作与旧版本的jQuery:
$(document).ready(function () { $(".theImage").on("click",function(){ // In the event clicked,find image,fade slowly to .01 opacity $(this).find("img").fadeTo("slow",.01).end() // Then,of siblings,find all images and fade slowly to 100% opacity .siblings().find("img").fadeTo("slow",1); }) })
任何形式的帮助是赞赏。
bind
而不是
on
,因为仅在
jQuery 1.7中引入。
$(document).ready(function () { $(".theImage").bind("click",find all images and fade slowly to 100% opacity .siblings().find("img").fadeTo("slow",1); }) })
以上是大佬教程为你收集整理的jquery – Uncaught TypeError:Object [object Object]没有方法“on”全部内容,希望文章能够帮你解决jquery – Uncaught TypeError:Object [object Object]没有方法“on”所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ群:277859234,请注明来意。