I have a javascript variable I need to create like this:
var HTMLContent = '<div class="className">HTML Content</div>';
How can I format it in an easier to read format because I'm going to want to create multiple lines of HTML.
e.g.
var HTMLContent = '
<div class="className">
  HTML Content
</div>
';
Is something like that possible?
It would also be good if I could import via URL e.g. var HTMLContent = 'http://domain.com/page.html';
 var longStr = "You can split\
 the string onto multiple lines\
 like so";
An example using your HTML would be:
var longStr = 
    '<div class="className">\
        HTML Content\
    </div>';
To load external HTML, check out jQuery's load method:
$('#result').load('ajax/test.html');
                        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