marcamillion marcamillion - 5 months ago 31
Javascript Question

Uncaught TypeError is not a function on AJAX callback

In my

application.js
file, I have the following:

$(document).ready(function() {
/* Activating Best In Place */
jQuery(".best_in_place").best_in_place();

$('.highlight_on_success').bind("ajax:success", function(){$(this).closest('div.social-comment').effect('highlight');});
});


I am using the Best In Place gem, and it gives me the above function to use in my
best_in_place
call.

However, when I use it, I get this error in my JS console:

Uncaught TypeError: $(...).closest(...).effect is not a function application.self-440dd817e40548768e9.js:25


How do I fix this and get it work?

Answer

effect() is part of jQueryUI not jQuery core so either need to find a different editing script that doesn't have dependencies other than some css or use jQueryUI also in page to include that function.

Personally I would look for a different editor like X-ediable or other simlar plugin

Comments