I have the following code which simply parses HTML markup to a DOM object.
var html_str = '<div id="body-wrapper">\
<div id="container-1">\
<p>This is the first container - Line 1</p>\
<p>This is the first container - Line 2</p>\
<p><img src="assets/img/pull_1.jpg"></p>\
</div>\
<div id="container-2">\
<p>This is the second container - Line 1</p>\
<p>This is the second container - Line 2</p>\
<p>This is the second container - Line 3</p>\
<p><img src="assets/img/pull_2.jpg"></p>\
</div>\
<div id="container-3">\
<p>Test</p>\
<p><img src="assets/img/pull_3.jpg"></p>\
</div>\
</div>';
var elem_obj = document.createElement("div");
elem_obj.innerHTML = html_str;
How do I get the element with id == container-1
from within elem_obj
? Vanilla JavaScript only and something other than elem_obj.querySelector('#container-1')
because I need to support IE below version 8.
Thanks.