Monday, May 20, 2024
 Popular · Latest · Hot · Upcoming
190
rated 0 times [  193] [ 3]  / answers: 1 / hits: 21625  / 13 Years ago, tue, july 19, 2011, 12:00:00

I am trying to store a DOM element into a variable by using this code:



var save_status = $(this).siblings(.save-status)[0];
save_status.append(<img src=images/loading-small.gif width=30 />);


I get the following error though:



Uncaught SyntaxError: Unexpected identifier


Any idea why I might be getting this error?
Thanks!


More From » jquery

 Answers
10

Replace



save_status.append(<img src=images/loading-small.gif width=30 />);


with



save_status.append('<img src=images/loading-small.gif width=30 />');


The problem is in your quotations.


[#91127] Saturday, July 16, 2011, 13 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
beatrices

Total Points: 745
Total Questions: 103
Total Answers: 105

Location: Guam
Member since Tue, Nov 29, 2022
2 Years ago
;