Is there a way to save an HTML fragment in a variable using Javascript or jQuery? (obviously this is a non-working example)
var mysnippet = << EOF
<div class="myclass">
<div class="anotherclass">
Some dummy text
</div>
</div>
EOF
And then paste it into the document using jQuery:
mysnippet.append($('#someelement'));
EDIT:
Please read this before replying to the comment: I have an HTML fragment inside my JS file and I need to save it in a Javascript variable using something like this EOF construction. I need to avoid putting it between quotation marks.
If this is not possible using Javascript and / or jQuery, then the question has no solution.
source
share