I am creating a light box in pure JavaScript. For that I am making an overlay. I want to add this overlay to body but I also want to keep the content on the page. My current
You can make your div HTML code and set it directly into body(Or any element) with following code:
div
body
var divStr = 'Some html'; document.getElementsByTagName('body')[0].innerHTML += divStr;