-
Notifications
You must be signed in to change notification settings - Fork 0
/
DOM.js
26 lines (18 loc) · 805 Bytes
/
DOM.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
//Document object modelling codes
document.getElementsbyTagName("li");
document.getElementsbyLastName("btn");
document.getElementbyId("title");
document.querySelector("h1");
//Codes for separation of concern
document.querySelector("button").classList;
document.querySelector("button").classList.add("newclass");
document.querySelector("button").classList.remove("newclass");
document.querySelector("button").classList.toggle("newclass");
//Codes forText manipulation
document.getElementsbyId("title").innerHTML="Hello";
document.getElementsbyId("title").textContent="Bye";
//Codes for Elements manipulation
document.querySelector("a");
document.querySelector("a").attributes;
document.querySelector("a"). getAttributes("href");
document.querySelector("a").setAttributes("href","https://.......");