how to select elements in dom code example
Example: How to select an Element in JavaScript
// Selecting an Element by id:
document.getElementById("elem-id");
// Selecting Elements by class:
document.getElementsByClassName("elem-class");
// Selecting Elements by tag name:
document.getElementsByTagName("div");
// Selecting Elements by name:
document.getElementsByName("elem-name");
/* This method is like a jQuery selector
( #elemId -> id, .elemClass -> class, h1 -> tag name) */
document.querySelector(".container"); // class
document.querySelector("#demo"); // id
document.querySelector("div"); // tag name