Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

document.getElementById("main").innerHTML not working

Status
Not open for further replies.

tonynsx

Programmer
Aug 10, 2020
1
0
0
US
I have main.html, test.html and script.js in the same folder. I'm using a Python package called Eel, and that's how I'm interacting with html and Javascript. When I call function dummy() as shown below, I get a print statement from Python, which is exactly what I want, but when I change the "main" to "test" in the dummy() it doesn't print anything. Why is that? How come script.js knows about "main", but not about "test"?

main.html
[pre]<div>
<p id="main">This is from main.html</p>
<input type="submit" name="" onclick="dummy()"></input>
<div>[/pre]

test.html
[pre]<p id="test">This is p tag in test.html</p>[/pre]

script.js
[pre]function dummy() {
u = document.getElementById("main").innerHTML
eel.dummy(u)
}
[/pre]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top