0
Who can explain what this code does in javascript
document.getElementById("paragraph").textcontent ="Hello, world";
3 Antworten
+ 2
If looks like you're trying to set the textContent of an element which has an id of "paragraph" to "Hello, world".
It will do that as long as:
* You run the JavaScript after the DOM has loaded.
* You have an element which has a textContent property and has an id of "paragraph".
* You change the property you're trying to set from textcontent to textContent.
+ 1
This selects the Element with the ID "paragraph" from "document" and sets its textcontent to "Hello, world".
After that will somewhere on your Website be shown: Hello, world"
0
It's basically the text content , (what's written in it ), of the element with id "para".
Like
<div id="para" > Hello world </div>
Hello world is it's text content