Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

jQuery setTimeout on Append

Tags:

jquery

I am trying to set a timeout on the following append method in jQuery. Everything I've tried keeps returning Uncaught SyntaxError: Unexpected identifier

Here is my code:

    setTimeout("$('#user-comments').append('<div class='video_comment'>
<div class='name'>David</div><div class='time'>test</div>
<div class='indiv-comment'><p>'"+message+"'</p></div></div><hr class='gray' />')",3000);

Any help is appreciated.

like image 827
Jako Avatar asked Feb 20 '23 01:02

Jako


1 Answers

setTimeout(function () {
    $("#user-comments").append('<div class="video_comment">
                                <div class="name">David</div>
                                <div class="time"><?php echo date('F j, Y, g:i a'); ?></div>
                                <div class="indiv-comment"><p>' + message + '</p></div></div>');
}, 3000);
like image 69
Andreas Grech Avatar answered May 22 '23 19:05

Andreas Grech