Why does not work, when transferring the line?
var _wnd_content = ' <div id="abc"> text </div> ';
text'; html javascr...">
Why does not work, when transferring the line?
var _wnd_content = ' <div id="abc"> text </div> ';
Because the syntax does not allow this.
Options:
var _wnd_content = '\ <div id="abc"> \ text \ </div>';
Using an array:
var _wnd_content = [ '<div id="abc">', ' text', '</div>' ].join("\n");
As usually do template engines:
<script type="text/x-my-template" id="template_abc"> <div id="abc"> text </div> </script> var _wnd_content = $("#template_abc").html();
Using E4X (there will be a tree, not a string; and this does not work, at least in IE):
var _wnd_content = <div id="abc">text</div>;
ECMAScript 6 (this is how it will be in the bright future):
var _wnd_content = ` <div id="abc"> text </div> `;
Source: https://ru.stackoverflow.com/questions/105424/
All Articles