<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Gaurav Tewari</title>
    <description>The latest articles on DEV Community by Gaurav Tewari (@tewarig).</description>
    <link>https://dev.to/tewarig</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F425024%2Fcd6959ba-87e8-4dd3-9d49-394eb867d67c.png</url>
      <title>DEV Community: Gaurav Tewari</title>
      <link>https://dev.to/tewarig</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/tewarig"/>
    <language>en</language>
    <item>
      <title>What is exactly Dom and Dom manipulation in a snap  </title>
      <dc:creator>Gaurav Tewari</dc:creator>
      <pubDate>Tue, 01 Jun 2021 15:06:24 +0000</pubDate>
      <link>https://dev.to/tewarig/what-is-exactly-dom-and-dom-manipulation-in-a-snap-1pc0</link>
      <guid>https://dev.to/tewarig/what-is-exactly-dom-and-dom-manipulation-in-a-snap-1pc0</guid>
      <description>&lt;p&gt;In this article, we will go through the dom and dom manipulation.&lt;/p&gt;

&lt;h1&gt;
  
  
  what is exactly dom?
&lt;/h1&gt;

&lt;p&gt;DOM (document object model ) is basically a programming API for HTML and XML documents, with dom you can specify how your document should be structured.&lt;br&gt;
with dom, we can easily manipulate the elements of our document.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--r3Ec83Em--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1622558791388/Mflhz9jSV.jpeg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--r3Ec83Em--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1622558791388/Mflhz9jSV.jpeg" alt="Dom_210601_193748_1.jpg"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;According to the dom model, every element is an object, and even the nested tags are the objects and chile of the enclosing one. HTML dome basically looks like a tree. it is also called a tree.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--tqrGxUMT--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1622558821751/Q_XCHL7Qx.jpeg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--tqrGxUMT--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn.hashnode.com/res/hashnode/image/upload/v1622558821751/Q_XCHL7Qx.jpeg" alt="Dom_210601_193748_2.jpg"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h1&gt;
  
  
  try is yourself
&lt;/h1&gt;

&lt;p&gt;open the console of your browser right now. &lt;br&gt;
&lt;strong&gt;press ctrl + shift + j&lt;/strong&gt;&lt;br&gt;
enter this in the console of your browser.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;console.log(document);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;what do you get?&lt;br&gt;
you will get the entire HTML document returned.&lt;br&gt;
here the document object represents the entire web page.&lt;/p&gt;

&lt;p&gt;if we want to access any element in the web page we need to start accessing that with the help of the document object.&lt;/p&gt;

&lt;p&gt;for example, if you want to get the domain of the page ...  just type&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;console.log(document.domain)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h1&gt;
  
  
  How can I manipulate dom?
&lt;/h1&gt;

&lt;p&gt;well, there are many many ways to do that...&lt;br&gt;
you can use query selectors, getElement by class, or id&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt; document.querySelector(".myclass");
var x = document.querySelectorAll(".myclasses");

// if I want to change the background...
x.style.backgroundColor = "dark" ;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;this is how you can easily manipulate dom.&lt;/p&gt;

&lt;h1&gt;
  
  
  wrap up
&lt;/h1&gt;

&lt;p&gt;This is just a beginner article of my javascript series. where I would be sharing everything I am learning to prepare for interviews. positive or negative please leave your feedback.&lt;/p&gt;

&lt;p&gt;you can connect with me on  &lt;a href="https://twitter.com/OyeTewari"&gt;Twitter&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;you can support me on.&lt;br&gt;
&lt;a href="https://www.buymeacoffee.com/tewarig0"&gt;buymeacoffe&lt;/a&gt;&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>dom</category>
      <category>interview</category>
    </item>
  </channel>
</rss>
