cmwright
cmwright

Reputation: 3426

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 find 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

Upvotes: 0

Views: 163

Answers (2)

g.d.d.c
g.d.d.c

Reputation: 48048

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?

Upvotes: 3

dr jerry
dr jerry

Reputation: 10026

 delete('quotes')

Is looking a bit different in my preview

Upvotes: 0

Related Questions