Skip to content

Instantly share code, notes, and snippets.

@mattConn
Created August 27, 2016 23:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mattConn/e28f0f0824beee5601fd9f9c2dc36bfa to your computer and use it in GitHub Desktop.
Save mattConn/e28f0f0824beee5601fd9f9c2dc36bfa to your computer and use it in GitHub Desktop.
var newHTML = [
'<div class="foo">',
'<p>Readable HTML in JavaScript.</p>',
'</div>'
].join('');
@mattConn
Copy link
Author

mattConn commented Aug 27, 2016

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment