DOM Manipulations
-
Selecting Using get Element
a. getElementbyId()
b. getElementsbyName()
c. getElementsbyTagName()
d. getElementsbyClassName()
-
Selecting Using query Selectors
a. querySelector()
b. querySelectorAll()
-
Traversing
a. parentNode: get the parent node of a specified node in DOM tree
b. childNodes: get child element
c. previousElementSibling : get the previous sibling
d. nextElementSibling: get the next sibling
-
Manipulating Elements
a. createElement() : create a new html element
b. appendChild(): append an element as a child. gets added as last child
c. textContent: add/get text to elements
d. innerHTML: add/get the inner text including html tag and style
-
Manipulations Part 2
a. after(): add a node after the selected element. Can accept multiple nodes
b. append(): similar to appendChild(). but here we can add multiple nodes
c. prepend(): appends to first position. first child
d. insertAdjascentHTML(position, text)
e. replaceChild(newchild, oldchild)
f. cloneNode()
g. removeChild()
h. insertBefore()
-
Attributes Methods
a. getAttribute()
b. setAttribute()
c. hasAttribute()
d. removeAttribute()
-
Manipulating Styles
a. style
b. cssText
c. getComputedStyle()
d. className
e. classList
-
JS Events
a. onClick ==> event, event.type, event.target, this keyword.
b. binding and event handling
c. addEventListener()
d. removeEventListener()
e. mousemove
f. mousedown
g. mouseup
h. mouseover
i. mouseout
j. keydown
k. keyup
l. keypress
m. scroll