what is the syntax to store a block of html code to a javascript variable?
<div class='saved' > <div >test.test</div> <div class='remove'>[Remove]</div></div>
I want to assign the above code to a variable 'test'
var test = "<div class='saved' > <div >test.test</div> <div class='remove'>[Remove]</div></div>";
but it does not work, which are the correct syntax for assigning the code?
TIA
var test = "<div class='saved' >"+ "<div >test.test</div> <div class='remove'>[Remove]</div></div>";
You can add " " if you require line-break.
2.1m questions
2.1m answers
60 comments
57.0k users