- Fork and clone this repository.
- Change into the new directory.
Practice getting elements from the DOM using the common methods for interacting with the DOM!
For each of these you should store the result in a variable and console.log
it
see if you got it right.
The first set of DOM getters we'll talk about are the getElement(s)By
methods,
like getElementById
. Open up getelements.js
and work through the prompts.
The second set of DOM getters we'll talk about are querySelector
and
querySelectorAll
. Comment out getelements.js
in index.html
and uncomment
queryselector.js
. Then open up queryselector.js
and work through the
prompts.
Use the following methods of DOM nodes to update the content of the DOM:
innerHTML
outerHTML
innerText
outerText
textContent
The following are the three methods we can use to work with classes on a DOM node:
.classList.add()
.classList.remove()
.classList.toggle()
Use the data-*
attribute to add data to a DOM node. You can get that data in
JavaScript with a node's dataset
property.
- All content is licensed under a CCBYNCSA 4.0 license.
- All software code is licensed under GNU GPLv3. For commercial use or alternative licensing, please contact [email protected].