$(document)
.on("click", "#openModal", function() {
     $("body").append('<div id="shadow" style="position:absolute; top:0; left:0; width:100%; height:100%; background:#000; opacity:.5;"></div>').append('<div id="modal"><button id="closeModal">Close Modal</button></div>');
     $("#modal").load("file.html");
})
.on("click", "#closeModal", function() {
     $("#modal").remove(); 
     $("#shadow").remove();
})
 
  
  