Skip to content

This is a color changer project - a basic level project to learn javascript events

Notifications You must be signed in to change notification settings

nitesh-kohli/color-changer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 

Repository files navigation

color-changer

This is a color changer project - a basic level project to learn javascript

steps to build this basic project

in HTML

1.) create a div element in body.
2.) create 4 span tag in div element you have created earlier.
3.) give class and id to these span elements.
4.) class to make the buttons and id for the colors.

in JAVASCRIPT

1.) select buttons using querySelectorAll because we need buttons for click event.
2.) select body using querySelector because we need to change background-color of body.
3.) Now, for each button there must be an eventListener so that when we click on button we get event e from that button.
4.) Now check e.target.id == 'color' and change body's background color = color or e.target.id.
5.) two methods to check and change background color:-
i) if statement.
ii) switch statement.

About

This is a color changer project - a basic level project to learn javascript events

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published