function me(){
console.log("atharva")
}
me()
const buttons = document.querySelectorAll('.button');
const body = document.querySelector('body');
buttons.forEach((button) => {
console.log(button);
button.addEventListener('click', (e) => {
console.log(e);
console.log(e.target);
if (e.target.id == 'grey') {
body.style.backgroundColor = e.target.id;
}
if (e.target.id == 'white') {
body.style.backgroundColor = e.target.id;
}
if (e.target.id == 'blue') {
body.style.backgroundColor = e.target.id;
}
if (e.target.id == 'yellow') {
body.style.backgroundColor = e.target.id;
}
if (e.target.id == 'purple') {
body.style.backgroundColor = e.target.id;
}
});
});
-
Notifications
You must be signed in to change notification settings - Fork 0
atharvarakshak/javascriptPractise
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
About
No description, website, or topics provided.
Resources
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published