hi there! ๐๐
we have a couple of options to select and modify DOM elements:
querySelector()
querySelectorAll()
- getElementbyId / ClassName / Tagname
innerHTML()
text()
you can look up use cases for each of (speaking of which, there's actually forEach()
for looping through an array of elements selected by any of the methods mentioned before โ๏ธโ๏ธ ) these
From there you can listen for events with the amply named .addEventListener()
method, and you can modify elements based on the interaction. You can add previously defined CSS classes modifying the elements color, display
etc. properties, or you can use the {selector}.style.{property}
JS syntax to modify them directly (this approach is more hardware-heavy for clients)
Hope this was helpful!๐
Good luck and happy coding! ๐ช