shlogg · Early preview
Alish Giri @alishgiri

DOM Manipulation With JavaScript: Adding And Removing Classes

DOM represents web page structure, style & content. Programs can manipulate it using JavaScript. BOM (Browser Object Model) is like a container that includes DOM and other browser functionalities.

DOM

DOM stands for Document Object Model and represents the web page. This allows programs to manipulate the document structure, style, and content.

const listDiv = document.getElementById("list-div");
listDiv.classList.add('new-class');
listDiv.classList.remove('new-class');

    
    

    
    




  
  
  BOM

BOM stands for Browser Object Model and represents the browser's window. This allows programs to access browsers functionalities. BOM is like the big container which contains DOM and all other javascript stuff.

// DOM is part of BOM.
window.document.getElementById("list-div");
win...