Embed HTML Code in JavaScript File
Problem You would like to include HTML code as a String in a JavaScript file. Solution Firstly, load the HTML code into a JavaScript variable (e.g. by using jQuery.ajax()). $.ajax({url: 'http://mydomain.com/htmlfile.html'}) .done(function(html) { Then apply the following two simple regular