Problems with jQuery bind()
I'm getting an Unexpected TOKEN illegal
error on the following javascript:
$(function() {
$(‘.delete_post’).bind(‘ajax:success’, function() {
$(this).closest(‘tr’).fadeOut();
});
});
I've done quite a bit of research and can't seem to fi开发者_如何转开发nd any issue with this code. The error is being thrown on the 2nd line. The .delete_post
refers to a Destroy link class that should be removing elements from a page.
Any thoughts?
EDIT: The actual error given in the Chrome console is:
Uncaught SyntaxError: Unexpected token ILLEGAL
It looks like you're using back-tics instead of single quotes (apostrophes).
-- Per comments --
They're not backticks, they're left single quotes (thanks Gabi). Unfortunately, That's still probably enough to throw off the JS Engine. If you didn't mean to type them that way your editor is doing it automagically. What platform / editor are you working with?
delete('quotes')
Is looking a bit different in my preview
精彩评论