I have made a Js file where I have generated simple Html code:
var id = document.getElementById("Id1");
var html = "<div id = 'id2'>This is the text generated from JS</div>";
id.innerHTML = html;
The id "id1" exists in the HTML file. Now when I try to grab id2 in another function in returns null.
var result = document.getElementById("id2");
The value of variable "result" is showing null.
id2in the code above? also you have capital V forvarVarkeywords and you should be okay.