大佬教程收集整理的这篇文章主要介绍了jQuery效果返回undefined,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
$('.new_comment').live('ajax:success',function(evt,data,status,xhr){ $('.comments article:last').after(xhr.responseText).effect("highlight",{},3000); })
after()函数工作正常,但是effect()调用抛出了这个错误:
TypeError: 'undefined' is not a function (evaluaTing '$('.comments article:last').after(xhr.responseText).effect("highlight",3000)')
我正在使用jQuery 1.7.1和jQuery UI 1.8.16.
更新:xhr.responseText返回一个新创建的文章元素,如下所示:
<article id="2"> <h6><a href="#">Joe</a> <span>(<a href="#2">less than a minute ago</a>)</span></h6> <p>This is the new comment!</p> </article>
<section class="comments"> <h3>Comments</h3> <article id="1"> <h6><a href="#">Joe</a> <span>(<a href="#1">less than a minute ago</a>)</span></h6> <p>This is a comment!</p> </article> <article id="2"> <h6><a href="#">Joe</a> <span>(<a href="#2">less than a minute ago</a>)</span></h6> <p>This is the new comment!</p> </article> </section>
另外,如果我运行console.log($(‘.comments article:last’));,它肯定会返回创建的对象.
以上是大佬教程为你收集整理的jQuery效果返回undefined全部内容,希望文章能够帮你解决jQuery效果返回undefined所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。