nitesh-kohli / color-changer

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

Home Page:https://nitesh-kohli.github.io/color-changer/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

https://nitesh-kohli.github.io/color-changer/


Languages

Language:JavaScript 50.9%Language:HTML 30.2%Language:CSS 19.0%