DEV Community

Tharun Shiv
Tharun Shiv

Posted on β€’ Edited on

9 6

JavaScript DOM - Part 2 - The Document and Window Object [video + article]

This is going to be a multi-part Video + article tutorial series on JavaScript DOM. You're reading Part 2

You can read Part 1 here:

The Window Object

This is a Global object, which has several objects, attributes and functions within it. It can be described as an object with a lot of meta data and data about your webpage. It also contains the Document Object which is popularly used.

The Document Object

The Document Object is another global object which contains the attributes, objects, and functions of the website but of course lesser information than the window object as it is a subset of it.
You can access the complete information and elements of the DOM from this document object. To be precise, you can access each and every element of the page with a lot of functionality attached to it like methods, attributes, values, etc.,

// code

console.log(document.domain)

console.log(document.URL)

console.log(document.title)

console.log(document.all)

console.log(document.all[0])
Enter fullscreen mode Exit fullscreen mode
// respective output

tharunshiv.com

https://tharunshiv.com

Tharun Shiv - A blog to quench programming thirst

HTMLAllCollection(311) [html, head, meta, ...
...
...
...]

<html lang="en" data-react-helmet="lang">
  <head>...</head>
  <body>...</body>
</html>

Enter fullscreen mode Exit fullscreen mode

You can access and do a lot more magic with the Document Object. We will explore and do stuff in this series. All you have to know now is that there is The Window Object and there is a Document Object. You can access any element in the website using the Document Object. There are ways in which you can grab the necessary element that you want to, which we will be learning from the next video onwards.

Read part 3 here:

Thank you for reading 😊

Written by,

[deleted user] image

[Deleted User]

Top comments (4)

Collapse
 
chandrika56 profile image
Jaya chandrika reddy β€’

Good one.. πŸ‘

Collapse
 
developertharun profile image
Tharun Shiv β€’

Thank youπŸ™‚

Collapse
 
venkat121998 profile image
venkat anirudh β€’

Short and simple one... good goingπŸŽ‰

Collapse
 
developertharun profile image
Tharun Shiv β€’

Thankyou πŸ™‚

Neon image

Next.js applications: Set up a Neon project in seconds

If you're starting a new project, Neon has got your databases covered. No credit cards. No trials. No getting in your way.

Get started β†’

πŸ‘‹ Kindness is contagious

Explore a trove of insights in this engaging article, celebrated within our welcoming DEV Community. Developers from every background are invited to join and enhance our shared wisdom.

A genuine "thank you" can truly uplift someone’s day. Feel free to express your gratitude in the comments below!

On DEV, our collective exchange of knowledge lightens the road ahead and strengthens our community bonds. Found something valuable here? A small thank you to the author can make a big difference.

Okay