DEV Community

[Comment from a deleted post]
Collapse
 
raddevus profile image
raddevus

This is a nice short example of a JS event handler.

I believe another term for these are HTML DOM (Document Object Model) events. Because really the DOM raises the events and we actually capture (handle) them with event handlers in JavaScript.

I've been trying to switch my code from

document.getElementById("header1")

to

document.querySelector("#header1")

because it is more descriptive of the query selectors.

Do you ever use document.querySelector()? Just curious.

Collapse
 
stephanieopala profile image
Stephanie Opala

Thanks for your input.
And yes, I also use document.querySelector()