{"id":44048,"date":"2024-03-19T12:36:34","date_gmt":"2024-03-19T07:06:34","guid":{"rendered":"https:\/\/www.guvi.in\/blog\/?p=44048"},"modified":"2026-09-07T03:40:27","modified_gmt":"2026-09-06T22:10:27","slug":"what-is-dom-manipulation","status":"publish","type":"post","link":"https:\/\/www.guvi.in\/blog\/what-is-dom-manipulation\/","title":{"rendered":"What Is DOM Manipulation in JavaScript? Complete Beginner Guide With Examples [2026]"},"content":{"rendered":"\n<p>Click a button and a menu opens. Add a product to your cart and the number beside the cart icon changes instantly. Submit a form incorrectly and an error message appears below the field without reloading the page.<\/p>\n\n\n\n<p>JavaScript can create these interactions because it can access and modify the Document Object Model or DOM.<\/p>\n\n\n\n<p>The DOM gives JavaScript a structured representation of the webpage. Instead of treating HTML as one long piece of text, the browser represents its elements as objects arranged in a tree. JavaScript can then find these objects and change their content, attributes, styles or position.<\/p>\n\n\n\n<p>DOM manipulation is therefore one of the first concepts you should understand after learning basic JavaScript.<\/p>\n\n\n\n<p>This guide explains what DOM manipulation is, how the DOM works, common DOM methods, event handling, DOM traversal, practical examples and best practices for writing safer and cleaner JavaScript.<\/p>\n\n\n\n<p><strong>Quick Answer:<\/strong> DOM manipulation is the process of using JavaScript and browser DOM APIs to read, create, update, move or remove elements on a webpage. It allows developers to change a page dynamically in response to user actions or application data without rebuilding the entire HTML document.<\/p>\n\n\n\n<ul>\n<li><strong>Select elements:<\/strong> Use methods such as <code>getElementById()<\/code>, <code>querySelector()<\/code> and <code>querySelectorAll()<\/code>.<\/li>\n\n\n\n<li><strong>Change content and styles:<\/strong> Update text, classes, attributes and CSS properties.<\/li>\n\n\n\n<li><strong>Create or remove elements:<\/strong> Add new DOM nodes or delete existing ones.<\/li>\n\n\n\n<li><strong>Handle interactions:<\/strong> Use event listeners for clicks, typing, form submissions and other browser events.<\/li>\n\n\n\n<li><strong>Build dynamic interfaces:<\/strong> Update menus, forms, lists, dashboards and other UI components in real time.<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">What Is DOM Manipulation?<\/h2>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" width=\"1200\" height=\"630\" src=\"https:\/\/www.guvi.in\/blog\/wp-content\/uploads\/2026\/09\/image-246-1200x630.png\" alt=\"\" class=\"wp-image-137418\" srcset=\"https:\/\/www.guvi.in\/blog\/wp-content\/uploads\/2026\/09\/image-246-1200x630.png 1200w, https:\/\/www.guvi.in\/blog\/wp-content\/uploads\/2026\/09\/image-246-300x158.png 300w, https:\/\/www.guvi.in\/blog\/wp-content\/uploads\/2026\/09\/image-246-768x403.png 768w, https:\/\/www.guvi.in\/blog\/wp-content\/uploads\/2026\/09\/image-246-1536x806.png 1536w, https:\/\/www.guvi.in\/blog\/wp-content\/uploads\/2026\/09\/image-246-2048x1075.png 2048w, https:\/\/www.guvi.in\/blog\/wp-content\/uploads\/2026\/09\/image-246-150x79.png 150w\" sizes=\"(max-width: 1200px) 100vw, 1200px\" title=\"\"><\/figure>\n\n\n\n<p>The Document Object Model (DOM) is a programming interface for HTML, XML and similar documents. A browser represents a webpage as a logical tree made up of nodes and objects. JavaScript can use DOM APIs to access and modify those objects.<\/p>\n\n\n\n<p>DOM manipulation means changing this document structure through code.<\/p>\n\n\n\n<p>For example, JavaScript can:<\/p>\n\n\n\n<ul>\n<li>Change a heading<\/li>\n\n\n\n<li>Hide or show an element<\/li>\n\n\n\n<li>Add a <a href=\"https:\/\/www.guvi.in\/blog\/complete-css-tutorial\/\">CSS<\/a> class<\/li>\n\n\n\n<li>Update an image<\/li>\n\n\n\n<li>Create a new list item<\/li>\n\n\n\n<li>Remove an element<\/li>\n\n\n\n<li>Change an attribute<\/li>\n\n\n\n<li>React to a button click<\/li>\n\n\n\n<li>Update form validation messages<\/li>\n<\/ul>\n\n\n\n<p>Consider this HTML:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;h1 id=\"title\"&gt;Welcome&lt;\/h1&gt;\n<\/code><\/pre>\n\n\n\n<p>JavaScript can select and change the heading:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>const title = document.getElementById(\"title\");\ntitle.textContent = \"Welcome to JavaScript\";\n<\/code><\/pre>\n\n\n\n<p>The original HTML does not need to be manually rewritten. JavaScript accesses the DOM representation and updates the page.<\/p>\n\n\n\n<p>If you are still building your JavaScript foundation, follow this <a href=\"https:\/\/www.guvi.in\/blog\/javascript-frontend-roadmap\/\">complete JavaScript roadmap for frontend development<\/a> before moving into advanced browser APIs.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Is the DOM Part of JavaScript?<\/h2>\n\n\n\n<p>Not exactly.<\/p>\n\n\n\n<p>JavaScript is the programming language. The <strong>DOM is a Web API provided by the browser<\/strong>.<\/p>\n\n\n\n<p>The browser exposes objects such as:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>document\nwindow\nElement\nNode\nEvent\n<\/code><\/pre>\n\n\n\n<p>JavaScript can interact with these browser APIs.<\/p>\n\n\n\n<p>This distinction explains why JavaScript can also run outside a traditional webpage environment, such as Node.js, where a browser DOM is not automatically available.<\/p>\n\n\n\n<p>A simple way to remember it is:<\/p>\n\n\n\n<p><strong>HTML creates the page structure \u2192 Browser creates the DOM \u2192 JavaScript interacts with the DOM<\/strong><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">How Does the DOM Work?<\/h2>\n\n\n\n<p>Suppose a webpage contains:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;!DOCTYPE html&gt;\n&lt;html&gt;\n  &lt;head&gt;\n    &lt;title&gt;My Website&lt;\/title&gt;\n  &lt;\/head&gt;\n  &lt;body&gt;\n    &lt;h1&gt;Hello&lt;\/h1&gt;\n    &lt;p&gt;Welcome to my website.&lt;\/p&gt;\n  &lt;\/body&gt;\n&lt;\/html&gt;\n<\/code><\/pre>\n\n\n\n<p>The browser interprets this document as a tree-like structure:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Document\n\u2514\u2500\u2500 html\n    \u251c\u2500\u2500 head\n    \u2502   \u2514\u2500\u2500 title\n    \u2502       \u2514\u2500\u2500 \"My Website\"\n    \u2514\u2500\u2500 body\n        \u251c\u2500\u2500 h1\n        \u2502   \u2514\u2500\u2500 \"Hello\"\n        \u2514\u2500\u2500 p\n            \u2514\u2500\u2500 \"Welcome to my website.\"\n<\/code><\/pre>\n\n\n\n<p>Each element becomes a node that JavaScript can access.<\/p>\n\n\n\n<p>For example:<\/p>\n\n\n\n<ul>\n<li><code>document<\/code> represents the document.<\/li>\n\n\n\n<li><code>&lt;html&gt;<\/code> is the document element.<\/li>\n\n\n\n<li><code>&lt;head&gt;<\/code> and <code>&lt;body&gt;<\/code> are elements inside <code>&lt;html&gt;<\/code>.<\/li>\n\n\n\n<li><code>&lt;h1&gt;<\/code> and <code>&lt;p&gt;<\/code> are elements inside <code>&lt;body&gt;<\/code>.<\/li>\n\n\n\n<li>The text inside an element is represented by text nodes.<\/li>\n<\/ul>\n\n\n\n<p>Attributes such as <code>href<\/code>, <code>class<\/code> and <code>id<\/code> belong to an element, but they are <strong>not child nodes in the main DOM tree<\/strong>. MDN notes that attributes are associated with elements separately rather than existing as children in the document tree.<\/p>\n\n\n\n<p>Understanding HTML structure first makes DOM relationships much easier. You can review the <a href=\"https:\/\/www.guvi.in\/blog\/html-tutorial-guide-for-web-development\/\">HTML tutorial for web development<\/a> if you need a refresher.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Why Is DOM Manipulation Important?<\/h2>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" width=\"1200\" height=\"630\" src=\"https:\/\/www.guvi.in\/blog\/wp-content\/uploads\/2026\/09\/image-247-1200x630.png\" alt=\"\" class=\"wp-image-137419\" srcset=\"https:\/\/www.guvi.in\/blog\/wp-content\/uploads\/2026\/09\/image-247-1200x630.png 1200w, https:\/\/www.guvi.in\/blog\/wp-content\/uploads\/2026\/09\/image-247-300x158.png 300w, https:\/\/www.guvi.in\/blog\/wp-content\/uploads\/2026\/09\/image-247-768x403.png 768w, https:\/\/www.guvi.in\/blog\/wp-content\/uploads\/2026\/09\/image-247-1536x806.png 1536w, https:\/\/www.guvi.in\/blog\/wp-content\/uploads\/2026\/09\/image-247-2048x1075.png 2048w, https:\/\/www.guvi.in\/blog\/wp-content\/uploads\/2026\/09\/image-247-150x79.png 150w\" sizes=\"(max-width: 1200px) 100vw, 1200px\" title=\"\"><\/figure>\n\n\n\n<p>A page written only with <a href=\"https:\/\/www.guvi.in\/blog\/html-tutorial-guide-for-web-development\/\">HTML<\/a> and CSS can display information, but JavaScript and DOM manipulation allow that interface to respond to users.<\/p>\n\n\n\n<p>DOM manipulation is commonly used for:<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">1. Updating Content<\/h3>\n\n\n\n<p>Applications can change text or other content when data changes.<\/p>\n\n\n\n<p>Examples include:<\/p>\n\n\n\n<ul>\n<li>Shopping cart totals<\/li>\n\n\n\n<li>Notification counters<\/li>\n\n\n\n<li>Form messages<\/li>\n\n\n\n<li>Live scores<\/li>\n\n\n\n<li>Dashboard values<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\">2. Showing and Hiding Elements<\/h3>\n\n\n\n<p>Dropdown menus, popups, accordions and modal windows often rely on DOM changes.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">3. Building Dynamic Lists<\/h3>\n\n\n\n<p>A task manager can add a new task immediately after the user submits a form.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">4. Form Validation<\/h3>\n\n\n\n<p><a href=\"https:\/\/www.guvi.in\/blog\/javascript-tools-every-developer-should-know\/\" target=\"_blank\" rel=\"noreferrer noopener\">JavaScript<\/a> can display validation messages beside incorrect fields.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">5. Responding to User Actions<\/h3>\n\n\n\n<p><a href=\"https:\/\/www.guvi.in\/blog\/guide-for-html-dom\/\" target=\"_blank\" rel=\"noreferrer noopener\">DOM<\/a> events allow the application to react to:<\/p>\n\n\n\n<ul>\n<li>Clicks<\/li>\n\n\n\n<li>Typing<\/li>\n\n\n\n<li>Scrolling<\/li>\n\n\n\n<li>Mouse movement<\/li>\n\n\n\n<li>Form submission<\/li>\n\n\n\n<li>Keyboard input<\/li>\n<\/ul>\n\n\n\n<p>These interactions are fundamental to modern frontend development.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">DOM Selector Methods: Quick Comparison<\/h2>\n\n\n\n<p>Before changing an element, JavaScript normally needs to select it.<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><thead><tr><th><strong>Method<\/strong><\/th><th><strong>What It Selects<\/strong><\/th><th><strong>Returns<\/strong><\/th><th><strong>Live or Static?<\/strong><\/th><\/tr><\/thead><tbody><tr><td><code>getElementById()<\/code><\/td><td>Element matching an ID<\/td><td>Element or <code>null<\/code><\/td><td>Single element<\/td><\/tr><tr><td><code>querySelector()<\/code><\/td><td>First element matching a CSS selector<\/td><td>Element or <code>null<\/code><\/td><td>Single element<\/td><\/tr><tr><td><code>querySelectorAll()<\/code><\/td><td>All elements matching a CSS selector<\/td><td>NodeList<\/td><td>Static<\/td><\/tr><tr><td><code>getElementsByClassName()<\/code><\/td><td>Elements matching a class<\/td><td>HTMLCollection<\/td><td>Live<\/td><\/tr><tr><td><code>getElementsByTagName()<\/code><\/td><td>Elements matching a tag<\/td><td>HTMLCollection<\/td><td>Live<\/td><\/tr><tr><td><code>getElementsByName()<\/code><\/td><td>Elements matching a <code>name<\/code> attribute<\/td><td>NodeList<\/td><td>Live<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p>For modern frontend code, <code>querySelector()<\/code> and <code>querySelectorAll()<\/code> are especially convenient because they accept familiar CSS selector syntax.<\/p>\n\n\n\n<p>If CSS selectors are unfamiliar, read this <a href=\"https:\/\/www.guvi.in\/blog\/guide-for-css-selectors\/\" target=\"_blank\" rel=\"noreferrer noopener\">guide to CSS selectors<\/a> before practising DOM queries.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">1. Selecting DOM Elements<\/h3>\n\n\n\n<h4 class=\"wp-block-heading\">Using getElementById()<\/h4>\n\n\n\n<p>Use an element&#8217;s unique ID:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;h2 id=\"message\"&gt;Hello&lt;\/h2&gt;\n<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>const message = document.getElementById(\"message\");\n<\/code><\/pre>\n\n\n\n<h4 class=\"wp-block-heading\">Using querySelector()<\/h4>\n\n\n\n<p><code>querySelector()<\/code> returns the first element matching a CSS selector.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>const button = document.querySelector(\".submit-button\");\n<\/code><\/pre>\n\n\n\n<p>You can use IDs, classes, attributes or other CSS selectors:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>document.querySelector(\"#header\");\ndocument.querySelector(\".card\");\ndocument.querySelector(\"input&#91;type='email']\");\n<\/code><\/pre>\n\n\n\n<h4 class=\"wp-block-heading\">Using querySelectorAll()<\/h4>\n\n\n\n<p>Use this when multiple elements need to be selected:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>const cards = document.querySelectorAll(\".card\");\n<\/code><\/pre>\n\n\n\n<p>You can then iterate through the NodeList:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>cards.forEach((card) =&gt; {\n  console.log(card.textContent);\n});\n<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">2. Changing Text and Content<\/h3>\n\n\n\n<p>One of the simplest DOM operations is updating text.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;p id=\"status\"&gt;Waiting...&lt;\/p&gt;\n<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>const status = document.querySelector(\"#status\");\n\nstatus.textContent = \"Completed\";\n<\/code><\/pre>\n\n\n\n<h4 class=\"wp-block-heading\">textContent vs innerHTML<\/h4>\n\n\n\n<p>Both can change an element&#8217;s contents, but they behave differently.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>element.textContent = \"Hello\";\n<\/code><\/pre>\n\n\n\n<p>inserts plain text.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>element.innerHTML = \"&lt;strong&gt;Hello&lt;\/strong&gt;\";\n<\/code><\/pre>\n\n\n\n<p>parses the string as HTML.<\/p>\n\n\n\n<p><code>innerHTML<\/code> should be used carefully. Inserting untrusted user-controlled content through HTML-parsing APIs can create cross-site scripting vulnerabilities. MDN identifies <code>innerHTML<\/code> as a potential injection sink when unsafe input is inserted into the DOM.<\/p>\n\n\n\n<p>For normal text, prefer:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>element.textContent = userInput;\n<\/code><\/pre>\n\n\n\n<p>rather than:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>element.innerHTML = userInput;\n<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">3. Changing CSS With JavaScript<\/h3>\n\n\n\n<p>JavaScript can modify styles directly:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>const box = document.querySelector(\".box\");\n\nbox.style.backgroundColor = \"black\";\nbox.style.padding = \"20px\";\n<\/code><\/pre>\n\n\n\n<p>However, adding and removing CSS classes is usually cleaner.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>box.classList.add(\"active\");\n<\/code><\/pre>\n\n\n\n<p>Remove a class:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>box.classList.remove(\"active\");\n<\/code><\/pre>\n\n\n\n<p>Toggle a class:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>box.classList.toggle(\"dark-mode\");\n<\/code><\/pre>\n\n\n\n<p>Check whether a class exists:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>box.classList.contains(\"active\");\n<\/code><\/pre>\n\n\n\n<p>This keeps visual styling inside CSS instead of spreading large amounts of design logic throughout JavaScript.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">4. Modifying HTML Attributes<\/h3>\n\n\n\n<p>JavaScript can read or modify element attributes.<\/p>\n\n\n\n<p>Consider:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;img id=\"profile\" src=\"default.jpg\" alt=\"Profile image\"&gt;\n<\/code><\/pre>\n\n\n\n<p>Change an attribute:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>const image = document.querySelector(\"#profile\");\n\nimage.setAttribute(\"src\", \"user-photo.jpg\");\n<\/code><\/pre>\n\n\n\n<p>Read an attribute:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>const source = image.getAttribute(\"src\");\n<\/code><\/pre>\n\n\n\n<p>Remove one:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>image.removeAttribute(\"title\");\n<\/code><\/pre>\n\n\n\n<p>Some common properties can also be accessed directly:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>image.src = \"user-photo.jpg\";\nimage.alt = \"Vaishali's profile photo\";\n<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">5. Creating New DOM Elements<\/h3>\n\n\n\n<p>JavaScript can generate elements that were not originally present in the HTML.<\/p>\n\n\n\n<p>Create an element:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>const item = document.createElement(\"li\");\n<\/code><\/pre>\n\n\n\n<p>Add content:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>item.textContent = \"Learn DOM manipulation\";\n<\/code><\/pre>\n\n\n\n<p>Insert it into the page:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>const list = document.querySelector(\"#task-list\");\n\nlist.append(item);\n<\/code><\/pre>\n\n\n\n<p>You can also use:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>element.append()\nelement.prepend()\nelement.before()\nelement.after()\n<\/code><\/pre>\n\n\n\n<p>depending on where the new content should appear.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">6. Removing and Replacing Elements<\/h3>\n\n\n\n<p>An existing element can be removed with:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>const notification = document.querySelector(\".notification\");\n\nnotification.remove();\n<\/code><\/pre>\n\n\n\n<p>Replace a child element:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>parent.replaceChild(newElement, oldElement);\n<\/code><\/pre>\n\n\n\n<p>Or replace all children:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>container.replaceChildren(newElement);\n<\/code><\/pre>\n\n\n\n<p>These operations are useful when interfaces need to update sections based on changing application state.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">How Event Handling Works With DOM Manipulation<\/h2>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" width=\"1200\" height=\"630\" src=\"https:\/\/www.guvi.in\/blog\/wp-content\/uploads\/2026\/09\/image-248-1200x630.png\" alt=\"\" class=\"wp-image-137420\" srcset=\"https:\/\/www.guvi.in\/blog\/wp-content\/uploads\/2026\/09\/image-248-1200x630.png 1200w, https:\/\/www.guvi.in\/blog\/wp-content\/uploads\/2026\/09\/image-248-300x158.png 300w, https:\/\/www.guvi.in\/blog\/wp-content\/uploads\/2026\/09\/image-248-768x403.png 768w, https:\/\/www.guvi.in\/blog\/wp-content\/uploads\/2026\/09\/image-248-1536x806.png 1536w, https:\/\/www.guvi.in\/blog\/wp-content\/uploads\/2026\/09\/image-248-2048x1075.png 2048w, https:\/\/www.guvi.in\/blog\/wp-content\/uploads\/2026\/09\/image-248-150x79.png 150w\" sizes=\"(max-width: 1200px) 100vw, 1200px\" title=\"\"><\/figure>\n\n\n\n<p>A webpage becomes truly interactive when DOM manipulation is combined with <strong>events<\/strong>.<\/p>\n\n\n\n<p>Events describe something that happens inside the browser.<\/p>\n\n\n\n<p>Common events include:<\/p>\n\n\n\n<ul>\n<li><code>click<\/code><\/li>\n\n\n\n<li><code>input<\/code><\/li>\n\n\n\n<li><code>change<\/code><\/li>\n\n\n\n<li><code>submit<\/code><\/li>\n\n\n\n<li><code>keydown<\/code><\/li>\n\n\n\n<li><code>mouseover<\/code><\/li>\n\n\n\n<li><code>scroll<\/code><\/li>\n<\/ul>\n\n\n\n<p>Suppose you have:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;button id=\"changeButton\"&gt;Change Text&lt;\/button&gt;\n&lt;p id=\"message\"&gt;Original text&lt;\/p&gt;\n<\/code><\/pre>\n\n\n\n<p>JavaScript can listen for the click:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>const button = document.querySelector(\"#changeButton\");\nconst message = document.querySelector(\"#message\");\n\nbutton.addEventListener(\"click\", () =&gt; {\n  message.textContent = \"The text has changed!\";\n});\n<\/code><\/pre>\n\n\n\n<p>The sequence is:<\/p>\n\n\n\n<ol>\n<li>JavaScript selects the button.<\/li>\n\n\n\n<li><code>addEventListener()<\/code> listens for a click.<\/li>\n\n\n\n<li>The callback runs when the click occurs.<\/li>\n\n\n\n<li>JavaScript changes the paragraph in the DOM.<\/li>\n\n\n\n<li>The browser displays the updated content.<\/li>\n<\/ol>\n\n\n\n<p>This pattern appears throughout frontend applications.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">What Is Event Delegation?<\/h2>\n\n\n\n<p>Imagine a list containing 100 buttons.<\/p>\n\n\n\n<p>Instead of attaching 100 separate listeners, you can sometimes place one listener on their parent.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>const list = document.querySelector(\"#task-list\");\n\nlist.addEventListener(\"click\", (event) =&gt; {\n  if (event.target.matches(\".delete-button\")) {\n    event.target.closest(\"li\").remove();\n  }\n});\n<\/code><\/pre>\n\n\n\n<p>This technique is called <strong>event delegation<\/strong>.<\/p>\n\n\n\n<p>It works because many events propagate through ancestor elements.<\/p>\n\n\n\n<p>Event delegation is especially useful when elements are created dynamically after the page has loaded.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">DOM Traversal: Moving Between Elements<\/h2>\n\n\n\n<p>DOM manipulation often involves finding elements relative to another element.<\/p>\n\n\n\n<p>Useful properties and methods include:<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">parentElement<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>element.parentElement;\n<\/code><\/pre>\n\n\n\n<p>Returns the parent element.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">children<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>element.children;\n<\/code><\/pre>\n\n\n\n<p>Returns child elements.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">firstElementChild<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>element.firstElementChild;\n<\/code><\/pre>\n\n\n\n<p>Returns the first child element.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">nextElementSibling<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>element.nextElementSibling;\n<\/code><\/pre>\n\n\n\n<p>Returns the next sibling element.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">previousElementSibling<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>element.previousElementSibling;\n<\/code><\/pre>\n\n\n\n<p>Returns the previous sibling.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">closest()<\/h3>\n\n\n\n<p><code>closest()<\/code> searches the element and its ancestors for a matching selector.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>const card = button.closest(\".product-card\");\n<\/code><\/pre>\n\n\n\n<p>This is particularly useful in event-driven interfaces.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Practical DOM Manipulation Example<\/h2>\n\n\n\n<p>Consider a simple task list.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">HTML<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;input id=\"taskInput\" type=\"text\" placeholder=\"Enter a task\"&gt;\n&lt;button id=\"addTask\"&gt;Add Task&lt;\/button&gt;\n\n&lt;ul id=\"taskList\"&gt;&lt;\/ul&gt;\n<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">JavaScript<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>const input = document.querySelector(\"#taskInput\");\nconst button = document.querySelector(\"#addTask\");\nconst list = document.querySelector(\"#taskList\");\n\nbutton.addEventListener(\"click\", () =&gt; {\n  const task = input.value.trim();\n\n  if (!task) {\n    return;\n  }\n\n  const listItem = document.createElement(\"li\");\n  listItem.textContent = task;\n\n  list.append(listItem);\n\n  input.value = \"\";\n});\n<\/code><\/pre>\n\n\n\n<p>Several DOM concepts appear in this small example:<\/p>\n\n\n\n<ul>\n<li><code>querySelector()<\/code> selects elements.<\/li>\n\n\n\n<li><code>addEventListener()<\/code> responds to the user.<\/li>\n\n\n\n<li><code>.value<\/code> reads form input.<\/li>\n\n\n\n<li><code>createElement()<\/code> creates a node.<\/li>\n\n\n\n<li><code>textContent<\/code> adds safe text.<\/li>\n\n\n\n<li><code>append()<\/code> places the element in the document.<\/li>\n<\/ul>\n\n\n\n<p>This is why small JavaScript projects are useful when learning DOM manipulation. They combine several concepts instead of practising methods in isolation.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">DOM Manipulation With Forms<\/h2>\n\n\n\n<p>Forms are another common use case.<\/p>\n\n\n\n<p>Consider:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;form id=\"signupForm\"&gt;\n  &lt;input id=\"email\" type=\"email\"&gt;\n  &lt;button type=\"submit\"&gt;Sign Up&lt;\/button&gt;\n&lt;\/form&gt;\n\n&lt;p id=\"error\"&gt;&lt;\/p&gt;\n<\/code><\/pre>\n\n\n\n<p>JavaScript:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>const form = document.querySelector(\"#signupForm\");\nconst email = document.querySelector(\"#email\");\nconst error = document.querySelector(\"#error\");\n\nform.addEventListener(\"submit\", (event) =&gt; {\n  event.preventDefault();\n\n  if (!email.value.trim()) {\n    error.textContent = \"Please enter your email address.\";\n    return;\n  }\n\n  error.textContent = \"\";\n});\n<\/code><\/pre>\n\n\n\n<p><code>preventDefault()<\/code> stops the browser&#8217;s normal form submission behaviour so JavaScript can handle the interaction first.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">DOM Manipulation vs Virtual DOM<\/h2>\n\n\n\n<p>You may also encounter the term <strong>Virtual DOM<\/strong> while learning frameworks such as React.<\/p>\n\n\n\n<p>They are not the same thing.<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><thead><tr><th><strong>DOM<\/strong><\/th><th><strong>Virtual DOM<\/strong><\/th><\/tr><\/thead><tbody><tr><td>Browser representation of the document<\/td><td>JavaScript representation used by some frameworks<\/td><\/tr><tr><td>Directly affects the webpage<\/td><td>Used to determine what should change<\/td><\/tr><tr><td>Provided by the browser<\/td><td>Implemented by a library or framework<\/td><\/tr><tr><td>Can be manipulated with native Web APIs<\/td><td>Framework handles many DOM updates<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p>When you write:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>document.querySelector(\"#title\").textContent = \"Hello\";\n<\/code><\/pre>\n\n\n\n<p>you are directly manipulating the browser DOM.<\/p>\n\n\n\n<p>Frameworks may abstract much of this work, but understanding native DOM manipulation remains valuable because the browser ultimately renders DOM elements.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">DOM Manipulation and jQuery<\/h2>\n\n\n\n<p>Older web-development tutorials frequently use <strong>jQuery<\/strong> for DOM manipulation.<\/p>\n\n\n\n<p>For example, jQuery might use:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$(\"#title\").text(\"Hello\");\n<\/code><\/pre>\n\n\n\n<p>Modern browser APIs can perform the same task directly:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>document.querySelector(\"#title\").textContent = \"Hello\";\n<\/code><\/pre>\n\n\n\n<p>jQuery still exists and is used in older projects, but modern JavaScript provides many native APIs that previously required helper libraries.<\/p>\n\n\n\n<p>If you encounter it while maintaining older websites, this guide to <a href=\"https:\/\/www.guvi.in\/blog\/concept-of-jquery\/\">what jQuery is and how it works<\/a> can help you understand the difference.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Best Practices for DOM Manipulation<\/h2>\n\n\n\n<p>Writing working DOM code is only the first step. Good frontend code should also remain readable, maintainable and secure.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">1. Use Clear Selectors<\/h3>\n\n\n\n<p>Prefer selectors that clearly identify the element&#8217;s role.<\/p>\n\n\n\n<p>Instead of relying on fragile nested selectors such as:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>document.querySelector(\"body div section div button\");\n<\/code><\/pre>\n\n\n\n<p>use a meaningful class or ID.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>document.querySelector(\".checkout-button\");\n<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">2. Prefer textContent for Plain Text<\/h3>\n\n\n\n<p>If you only need to insert text:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>element.textContent = value;\n<\/code><\/pre>\n\n\n\n<p>This avoids unnecessarily parsing the value as HTML.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">3. Be Careful With innerHTML<\/h3>\n\n\n\n<p>Never insert untrusted user input directly into <code>innerHTML<\/code>.<\/p>\n\n\n\n<p>HTML injection can lead to cross-site scripting attacks. Use safe text insertion or properly sanitize trusted HTML when HTML markup is genuinely required.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">4. Use classList for Styling Changes<\/h3>\n\n\n\n<p>Instead of changing ten individual style properties in JavaScript, define a CSS class and toggle it:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>menu.classList.toggle(\"open\");\n<\/code><\/pre>\n\n\n\n<p>This creates a cleaner separation between behaviour and presentation.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">5. Store Frequently Used Elements<\/h3>\n\n\n\n<p>If the same element is needed throughout a script, select it once:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>const menu = document.querySelector(\"#menu\");\n<\/code><\/pre>\n\n\n\n<p>Then reuse the reference.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">6. Use Event Delegation Where Appropriate<\/h3>\n\n\n\n<p>Dynamic lists, menus and tables can often share one event listener on a parent rather than attaching listeners to every child.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">7. Keep Accessibility in Mind<\/h3>\n\n\n\n<p>DOM changes should remain understandable to keyboard and assistive-technology users.<\/p>\n\n\n\n<p>For example:<\/p>\n\n\n\n<ul>\n<li>Use real <code>&lt;button&gt;<\/code> elements for actions.<\/li>\n\n\n\n<li>Maintain visible focus states.<\/li>\n\n\n\n<li>Update appropriate ARIA attributes when expanding components.<\/li>\n\n\n\n<li>Do not rely entirely on colour or animation to communicate a state change.<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\">8. Optimise for Readability Before Micro-Optimising<\/h3>\n\n\n\n<p><code>DocumentFragment<\/code> can be useful when assembling a group of nodes before adding them to the document:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>const fragment = document.createDocumentFragment();\n\nfor (let i = 1; i &lt;= 5; i++) {\n  const item = document.createElement(\"li\");\n  item.textContent = `Item ${i}`;\n\n  fragment.append(item);\n}\n\nlist.append(fragment);\n<\/code><\/pre>\n\n\n\n<p>However, MDN notes that the performance benefit of <code>DocumentFragment<\/code> is sometimes overstated and recommends prioritising readable code rather than assuming it is automatically faster.<\/p>\n\n\n\n<p><em>Build strong JavaScript and full-stack development skills to understand DOM manipulation with confidence through HCL GUVI\u2019s <a href=\"https:\/\/www.guvi.in\/zen-class\/full-stack-development-course\/?utm_source=blog&amp;utm_medium=hyperlink&amp;utm_campaign=what-is-dom-manipulation-in-javascript-complete-beginner-guide-with-examples-2026\">Full Stack Development Course.<\/a> Learn HTML, CSS, JavaScript, frontend development, backend APIs, databases, and real-world web projects through structured training designed for beginners and aspiring full-stack developers in 2026.<\/em><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Common DOM Manipulation Mistakes<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">1. Using innerHTML for Everything<\/h3>\n\n\n\n<p><code>innerHTML<\/code> is convenient, but it is unnecessary for plain-text updates and introduces additional security considerations.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">2. Assuming an Element Always Exists<\/h3>\n\n\n\n<p>This can fail:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>document.querySelector(\"#button\").addEventListener(\"click\", handler);\n<\/code><\/pre>\n\n\n\n<p>if <code>#button<\/code> does not exist.<\/p>\n\n\n\n<p>A safer pattern is:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>const button = document.querySelector(\"#button\");\n\nif (button) {\n  button.addEventListener(\"click\", handler);\n}\n<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">3. Mixing Too Much Styling Into JavaScript<\/h3>\n\n\n\n<p>Large blocks of:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>element.style...\n<\/code><\/pre>\n\n\n\n<p>make code difficult to maintain. Prefer CSS classes.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">4. Adding Too Many Individual Event Listeners<\/h3>\n\n\n\n<p>Large dynamic collections may benefit from event delegation.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">5. Forgetting preventDefault()<\/h3>\n\n\n\n<p>Forms and links have default browser behaviour. When JavaScript needs to control that behaviour, <code>event.preventDefault()<\/code> may be necessary.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">6. Manipulating Elements Before They Exist<\/h3>\n\n\n\n<p>If a script runs before the relevant HTML is parsed, selectors may return <code>null<\/code>.<\/p>\n\n\n\n<p>Placing scripts appropriately or waiting for the document to be ready prevents this problem.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Is DOM Manipulation Still Important in Modern Web Development?<\/h2>\n\n\n\n<p>Yes.<\/p>\n\n\n\n<p>Frameworks such as React, <a href=\"https:\/\/www.guvi.in\/blog\/vuejs-project-ideas\/\">Vue<\/a> and Angular reduce the amount of direct DOM manipulation developers write manually, but the underlying browser still works with DOM nodes.<\/p>\n\n\n\n<p>Understanding the DOM helps developers understand:<\/p>\n\n\n\n<ul>\n<li>Event propagation<\/li>\n\n\n\n<li>Browser rendering<\/li>\n\n\n\n<li>Form behaviour<\/li>\n\n\n\n<li>Accessibility<\/li>\n\n\n\n<li>Element relationships<\/li>\n\n\n\n<li>Debugging<\/li>\n\n\n\n<li>Framework behaviour<\/li>\n\n\n\n<li>Client-side security<\/li>\n<\/ul>\n\n\n\n<p>GUVI&#8217;s current <a href=\"https:\/\/www.guvi.in\/blog\/how-to-become-a-web-developer\/\">web development roadmap<\/a> also places DOM manipulation and event handling among the core JavaScript concepts frontend developers should learn.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">How to Learn DOM Manipulation as a Beginner<\/h2>\n\n\n\n<p>A good learning sequence is:<\/p>\n\n\n\n<ol>\n<li>Learn HTML elements and attributes.<\/li>\n\n\n\n<li>Understand JavaScript variables, functions and arrays.<\/li>\n\n\n\n<li>Practise selecting DOM elements.<\/li>\n\n\n\n<li>Change text and CSS classes.<\/li>\n\n\n\n<li>Create and remove elements.<\/li>\n\n\n\n<li>Learn events and event listeners.<\/li>\n\n\n\n<li>Practise forms.<\/li>\n\n\n\n<li>Learn DOM traversal.<\/li>\n\n\n\n<li>Build small interactive projects.<\/li>\n\n\n\n<li>Move towards APIs and <a href=\"https:\/\/www.guvi.in\/blog\/best-frontend-development-frameworks\/\" target=\"_blank\" rel=\"noreferrer noopener\">frontend frameworks.<\/a><\/li>\n<\/ol>\n\n\n\n<p>Projects are where DOM concepts start to make sense.<\/p>\n\n\n\n<p>Try building:<\/p>\n\n\n\n<ul>\n<li>To-do list<\/li>\n\n\n\n<li>Counter<\/li>\n\n\n\n<li>FAQ accordion<\/li>\n\n\n\n<li>Modal window<\/li>\n\n\n\n<li>Image gallery<\/li>\n\n\n\n<li>Form validator<\/li>\n\n\n\n<li>Dark mode toggle<\/li>\n\n\n\n<li>Quiz<\/li>\n\n\n\n<li>Shopping cart interface<\/li>\n\n\n\n<li>Search filter<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">Conclusion<\/h2>\n\n\n\n<p>DOM manipulation is what turns basic HTML pages into interactive experiences.<\/p>\n\n\n\n<p>The browser converts the document into a tree of objects. JavaScript can then select those objects, change their content, modify classes and attributes, create new elements, remove old ones and respond to events.<\/p>\n\n\n\n<p>You do not need to memorise every DOM method at once.<\/p>\n\n\n\n<p>Start with <code>querySelector()<\/code>, <code>textContent<\/code>, <code>classList<\/code>, <code>createElement()<\/code>, <code>append()<\/code> and <code>addEventListener()<\/code>. Build small projects with them. Once these operations feel natural, concepts such as event delegation, DOM traversal, dynamic forms and frontend frameworks become much easier to understand.<\/p>\n\n\n\n<p>DOM manipulation remains a fundamental frontend skill because even when a framework handles many updates for you, the browser ultimately renders and interacts with the DOM.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">FAQs<\/h2>\n\n\n<div id=\"rank-math-faq\" class=\"rank-math-block\">\n<div class=\"rank-math-list \">\n<div id=\"faq-question-1788127801788\" class=\"rank-math-list-item\">\n<h3 class=\"rank-math-question \">What is DOM manipulation in JavaScript?<\/h3>\n<div class=\"rank-math-answer \">\n\n<p>DOM manipulation is the process of using JavaScript and DOM APIs to access and change a webpage&#8217;s document structure. Developers can modify text, attributes, styles and elements or respond to user interactions such as clicks and form submissions.<\/p>\n\n<\/div>\n<\/div>\n<div id=\"faq-question-1788127818338\" class=\"rank-math-list-item\">\n<h3 class=\"rank-math-question \">What is an example of DOM manipulation?<\/h3>\n<div class=\"rank-math-answer \">\n\n<p>Changing a heading after a button click is a simple example:<br \/><code>const heading = document.querySelector(\"h1\"); heading.textContent = \"New Heading\";<\/code><br \/>JavaScript selects the existing <code>&lt;h1><\/code> node and changes the text represented in the DOM.<\/p>\n\n<\/div>\n<\/div>\n<div id=\"faq-question-1788127831320\" class=\"rank-math-list-item\">\n<h3 class=\"rank-math-question \">Why is DOM manipulation used?<\/h3>\n<div class=\"rank-math-answer \">\n\n<p>DOM manipulation makes webpages interactive and dynamic. It allows applications to update only the parts of the interface that need to change instead of requiring developers to manually rewrite the HTML or reload the entire page for every visual update.<\/p>\n\n<\/div>\n<\/div>\n<div id=\"faq-question-1788127848504\" class=\"rank-math-list-item\">\n<h3 class=\"rank-math-question \">What are the most common DOM manipulation methods?<\/h3>\n<div class=\"rank-math-answer \">\n\n<p>Common methods and properties include <code>getElementById()<\/code>, <code>querySelector()<\/code>, <code>querySelectorAll()<\/code>, <code>createElement()<\/code>, <code>append()<\/code>, <code>remove()<\/code>, <code>setAttribute()<\/code>, <code>classList<\/code>, <code>textContent<\/code> and <code>addEventListener()<\/code>.<br \/>Beginners should first become comfortable with selecting elements, changing content, creating nodes and handling events.<\/p>\n\n<\/div>\n<\/div>\n<div id=\"faq-question-1788127857837\" class=\"rank-math-list-item\">\n<h3 class=\"rank-math-question \">What is the difference between DOM and HTML?<\/h3>\n<div class=\"rank-math-answer \">\n\n<p>HTML is the markup written in the source document. The DOM is the browser&#8217;s object-based representation of that document in memory.<br \/>For example, HTML may initially contain a paragraph saying &#8220;Hello.&#8221; JavaScript can change the DOM so that the visible paragraph says &#8220;Welcome.&#8221; The browser displays the updated DOM even though the original HTML source sent by the server may remain unchanged.<\/p>\n\n<\/div>\n<\/div>\n<\/div>\n<\/div>","protected":false},"excerpt":{"rendered":"<p>Click a button and a menu opens. Add a product to your cart and the number beside the cart icon changes instantly. Submit a form incorrectly and an error message appears below the field without reloading the page. JavaScript can create these interactions because it can access and modify the Document Object Model or DOM. [&hellip;]<\/p>\n","protected":false},"author":60,"featured_media":137421,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[429,294,907],"tags":[],"views":"12748","authorinfo":{"name":"Vaishali","url":"https:\/\/www.guvi.in\/blog\/author\/vaishali\/"},"thumbnailURL":"https:\/\/www.guvi.in\/blog\/wp-content\/uploads\/2026\/09\/IMG_4215-300x116.png","_links":{"self":[{"href":"https:\/\/www.guvi.in\/blog\/wp-json\/wp\/v2\/posts\/44048"}],"collection":[{"href":"https:\/\/www.guvi.in\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.guvi.in\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.guvi.in\/blog\/wp-json\/wp\/v2\/users\/60"}],"replies":[{"embeddable":true,"href":"https:\/\/www.guvi.in\/blog\/wp-json\/wp\/v2\/comments?post=44048"}],"version-history":[{"count":43,"href":"https:\/\/www.guvi.in\/blog\/wp-json\/wp\/v2\/posts\/44048\/revisions"}],"predecessor-version":[{"id":137422,"href":"https:\/\/www.guvi.in\/blog\/wp-json\/wp\/v2\/posts\/44048\/revisions\/137422"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.guvi.in\/blog\/wp-json\/wp\/v2\/media\/137421"}],"wp:attachment":[{"href":"https:\/\/www.guvi.in\/blog\/wp-json\/wp\/v2\/media?parent=44048"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.guvi.in\/blog\/wp-json\/wp\/v2\/categories?post=44048"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.guvi.in\/blog\/wp-json\/wp\/v2\/tags?post=44048"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}