QP School
Select elements by ID in JavaScript - Printable Version

+- QP School (https://qomplainerzschool.lima-city.de)
+-- Forum: Tutorials (https://qomplainerzschool.lima-city.de/forumdisplay.php?fid=3)
+--- Forum: JavaScript Tutorials (https://qomplainerzschool.lima-city.de/forumdisplay.php?fid=6)
+--- Thread: Select elements by ID in JavaScript (/showthread.php?tid=4076)



Select elements by ID in JavaScript - Qomplainerz - 04-04-2023

The HTML part between the <body></body> tags looks like this:

Code:
<!-- Select elements by ID -->

<h1 id="message">JavaScript getElementById() Demo</h1>

The JavaScript part looks like this:

Code:
// Select elements by ID

document.getElementById("message").innerHTML = "Demo";