Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Select elements by ID in JavaScript
#1
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";
Also follow me on Youtube for videos about video games:
https://www.youtube.com/channel/UCxfkGVU...2mQ/videos
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Add elements at the beginning of an array in JavaScript Qomplainerz 0 352 04-04-2023, 07:37 AM
Last Post: Qomplainerz
  Add elements at the end of an array in JavaScript Qomplainerz 0 312 04-04-2023, 07:37 AM
Last Post: Qomplainerz
  Select elements by name in JavaScript Qomplainerz 0 319 04-04-2023, 07:36 AM
Last Post: Qomplainerz
  Select elements by tag name in JavaScript Qomplainerz 0 325 04-04-2023, 07:35 AM
Last Post: Qomplainerz
  Select elements by class name in JavaScript Qomplainerz 0 349 04-04-2023, 07:33 AM
Last Post: Qomplainerz
  Select elements by CSS selector in JavaScript Qomplainerz 0 340 04-04-2023, 07:18 AM
Last Post: Qomplainerz

Forum Jump:


Users browsing this thread: 6 Guest(s)