JavaScript 4

 DOM (Document Object Model)

The DOM represents a document with a logical tree.

It allows us to manipulate/change webpage content (HTML elements).


Using Properties & Methods

innerText
Shows the visible text contained in a node

textContent
Shows all the full text

innerHTML
Shows the full markup
----------------------------------------------------------------------

DOM Events

onclick (when an element is clicked)
onmouseenter (when mouse enters an element)

Event Listener
addEventListener - element.addEventListener( event, callback )
//check mdn more types

this in Event Listeners
When 'this' is used in a callback of event handler of something, it refers to that something.


0 Comments