I'm trying to put elements inside other elements dynamically using Javascript without refreshing the page, the AJAX part of it works and is functional. However for some unknown reason my code closes automatically.
Here is a snippet of the code, and you can see that it's no actually closed. But after running the code in a browser it is closed
HTML
<div id="Events">
Javascript
Get = document.getElementById("Events");
Get.innerHTML = "<div class='large-6 columns Pages' id='Page" + PN + "' style='background-color: #" + i + i + i + ";'>";
Get.innerHTML = Get.innerHTML + "<div class='large-6 columns Pages' id='Page" + PN + "' style='display: none; background-color: #" + i + i + i + ";'>";
The results on the page source are:
<div id="Page1" class="large-6 columns Pages" style="background-color: #000;"></div>
<div class="EventsClass"></div>
As you can see, this is a problem as I am trying to put elements inside elements. However I can't due to the closing tags.
I've search for a few hours and can't find a solution or even a cause to this.
There is NO closing tags, yet it is closed automatically. Is there a way to override this? Or bypass it?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…