Welcome to the Treehouse Community
The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

Rushabha Jain
Full Stack JavaScript Techdegree Student 11,140 PointsDOM or HTML Content?
Does document object refers to HTML content or DOM to select and manipulate elements? Like will 'getElementById' get the element from HTML content or will it look in the DOM to retrieve element.
1 Answer

Jamie Reardon
Treehouse Project ReviewerDOM stands for document object model which is a global object to the browser. Above that, you have the window object.
The getElementById is a method that belongs to the document object. It is used to select an element on a page that has the matching id attribute value. It therefore returns the element and not the html content.
Rushabha Jain
Full Stack JavaScript Techdegree Student 11,140 PointsRushabha Jain
Full Stack JavaScript Techdegree Student 11,140 Points@Jamie Reardon so, DOM is same as document object in javascript. correct?
Jamie Reardon
Treehouse Project ReviewerJamie Reardon
Treehouse Project ReviewerYes it is the same thing. You can access properties and methods through JavaScript using the document object. E.g. the write() method writes to the page.