I have created a div using the following code...
var bannerBox = document.createElement("div");
bannerBox.id = "bannerBox";
...and a second div as follows...
var bannerAd = document.createElement("div");
bannerAd.className = "bannerAd";
The above divs have been created in one function. Now in another function I tried to access the first div as follows...
var allAds = document.getElementById("bannerBox").childNodes;
...but it produces this error: uncaught error cannot read property childnodes of null