I need to append a lot of HTML code. To improve readability, I don't want to write that all in one line, but split them as regular HTML. That would be like 15 new-lines or something. The problem is that JavaScript doesn't allow me to do that.
var target = $('.post .comment_this[rel="' + comment_id + '"]').parent().parent();
target.append('
<div class="replies">
<p>...</p>
<img src="" alt="" />
</div>
');
Basically, I need to add HTML in that place.
I need to add some variables too.
target.append(' <div class="replies">'+
'<p>...</p>'+
'<img src="" alt="" />'+
'</div>'
);
or
target.append(' <div class="replies">\
<p>...</p>\
<img src="" alt="" />\
</div>'
);
Creating multiline strings in JavaScript
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With