CTEC3905 / js-get-elements

Example code for targeting HTML elements and making CSS changes via JS.

Home Page:https://ctec3905.github.io/js-get-elements/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

JavaScript examples for targeting various HTML elements

This example shows how to use JavaScript to target and change various different HTML elements using the key methods:

  • getElementById
  • getElementsByClassName
  • getElementsByTagName
  • querySelectorAll

There are three examples for triggering these changes:

  • addEventListener("click", ...
  • addEventListener("mouseover", ...
  • addEventListener("mouseout", ...

The styles are changed using CSS classes:

  • element.classList.add("style")
  • element.classList.remove("style")

About

Example code for targeting HTML elements and making CSS changes via JS.

https://ctec3905.github.io/js-get-elements/


Languages

Language:JavaScript 51.0%Language:HTML 46.7%Language:CSS 2.2%