if(document.getElementById('lightbox')!='null'){
alert("1");
body = document.getElementsByTagName('body')[0];
body.innerHTML='<div id="lightbox" class="hide"> </div>'+body.innerHTML+'';
}
Okay so id lightbox is just showing a greyed out overlay with 50% opacity, and class hide is display:none;.
I get the alert of 1 everytime the function is used.
So problem I'm having is this is called on loading the lightbox functon, but then I cannot hide the lightbox again using this:
document.getElementById('lightbox').style.display="none";
How can I put the lightbox div in using javascript and having it editable with the javascript?