Created
August 27, 2016 23:37
-
-
Save mattConn/e28f0f0824beee5601fd9f9c2dc36bfa to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var newHTML = [ | |
'<div class="foo">', | |
'<p>Readable HTML in JavaScript.</p>', | |
'</div>' | |
].join(''); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The above should prove to be a more readable way of creating HTML elements in JS. It is indifferent to indentation. Can be set as or concatenated with an existing element's HTML.
Demo:
http://codepen.io/mattConn/pen/mENrqw?editors=1011