Section 13/14 - DOM Flashcards
1
Q
native document selector
A
querySelector()
querySelectorAll()
2
Q
how to manipulate styles on dom elements
A
var e = document.getElementById(…)
e.style.color
e.style.border
etc.
3
Q
innerHTML
A
html content and text
4
Q
textContent
A
text node only
5
Q
how to manipulate attributes
A
e. getAttribute(‘href’)
e. setAttribute(‘href’, ‘google.com’)
6
Q
Add Native Event Listener
A
var e = document.querySelector('...'); e.addEventListener('click', function() { ... });
7
Q
Remove Native Event Listener
A
var e = document.querySelector('...'); e.removeEventListener('click', listenerFunction);
8
Q
hover event
A
mouseover
9
Q
hover stop event
A
mouseout
10
Q
How to pass event to onclick event added to html
A
<div></div>