I have 2 html files. I want to take the innerHTML of an element of the 1st HTML file and display it in the 2nd HTML.
This is the 1.html file
<h1 id="data">DATA</h1>
<button onclick="go()">GO</button>
This is the 2.html file
<h1 id="display"></h1>
This is what I tried in js but didn't work
function go() {
let data = document.getElementById("data").innerHTML;
document.getElementById("display").innerHTML = data;
window.open("2.html")
}
Please someone help
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…