Which of the following statements about the DOM (Document Object Model) in JavaScript is
Which of the following statements about the DOM (Document Object Model) in JavaScript is
true regarding its interaction with HTML and JavaScript?
AThe DOM only allows reading the HTML document but does not permit any changes or
updates.
BThe DOM allows JavaScript to directly modify the structure of the HTML document by
manipulating its elements, attributes and content.
CThe DOM is a static representation of the page and does not update dynamically when
changes occur in the document.
DThe DOM can only interact with text-based HTML documents and cannot modify styles
or events.
Show answerHide answer
Correct answer: (B) The DOM allows JavaScript to directly modify the structure of the HTML document by
manipulating its elements, attributes and content.
Explanation
The DOM is a live tree of the page. JavaScript can use it to add, remove or change elements, attributes, content, styles and events, and the page updates immediately.