I have the following block:
$('.new_comment').live('ajax:success', function(evt, data, status, xhr){ $('.comments article:last').after(xhr.responseText).effect("highlight", {}, 3000); })
So, when the new_comment form new_comment submitted, it calls it.
The after() function works fine, but calling effect() causes this error:
TypeError: 'undefined' is not a function (evaluating '$('.comments article:last').after(xhr.responseText).effect("highlight", {}, 3000)')
I am using jQuery 1.7.1 and jQuery UI 1.8.16.
UPDATE: xhr.responseText returns the newly created article element, for example:
<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>
After adding the DOM .comments looks like this:
<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>
Also, if I ran console.log($('.comments article:last')); , it will definitely return the created object.