Modal Templating

by ritcheyer

HTML

<html>
    <head></head>
<body>
<div id="contentToAdd">
    <p>This is some content to add to the Dom</p>
</div>
</body>
</html>

JavaScript

$(function(){

var wrap = $('<div />').addClass('modal'),
    content = $('#contentToAdd').html();
    
    wrap.html(content);
    
    $('body').append(wrap);
    
});