I'm building an app that allows the user to create an HTML page. When the user downloads their page I take all the HTML within the canvas div and save it as an HTML file, containing their page elements.
Now the problem is that I need to find a way to wrap the page with like this before they download.
Before Download
<div id="page-area">
// PAGE ELEMENTS
</div>
Result After Download
<html>
<head>
<title>page</title>
<head>
<body>
// PAGE ELEMENTS
</body>
</html>
What's the best way to wrap multiple elements with HTML, head, body, and other basic HTML structure tags? Looking for a jQuery solution or raw JavaScript.
So for example if I could take all of these elements
<ul>
<li>List</li>
</ul>
<div id="tabs">
<span>test</span>
</tabs>
And wrap then with the basic HTML structure like this
<html>
<head>
</head>
<body>
<ul>
<li>List</li>
</ul>
<div id="tabs">
<span>test</span>
</tabs>
</body>
</html>
How would I do that with jQuery?