I'm just trying to retrieve the dom of the two html page on the same javascript file.
When i try to retrive the the dom of an element of the first html page, it works, but the elements of the second page return me undefined. How can i try to retrieve the element of the second page ?
firstpage.html
<p id="first">test first</p>
secondpage.html
<p id="second">test second</p>
file.js
var first = document.getElementById("first").innerHTML;
console.log(first); // will show me "test first"
var second = document.getElementById("second").innerHTML;
console.log(second); // will show me "undefined" .. :(
Thanks for the help !