Skip to content

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

Notifications You must be signed in to change notification settings

CTEC3905/js-get-elements

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 

Repository files navigation

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.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published