Skip to content

Instantly share code, notes, and snippets.

View juliettech13's full-sized avatar
πŸ‘©β€πŸ’»
coding & talking about it

_juliettech juliettech13

πŸ‘©β€πŸ’»
coding & talking about it
View GitHub Profile
const paragraph = document.querySelector('p');
paragraph.addEventListener('click', (event) => {
// First, we select the element we want to animate and confirm we are grabbing the right one.
const element = event.target; // In this scenario, the target is paragraph itself.
console.log(element); // note: this should be removed once the right element has been confirmed.
// Then, we perform the animation we want to occur when the click event is triggered.
element.style.color = 'red' // Add here your favorite color hehe that red one is dis.gus.ting. Don't say I didn't warn you πŸ‘€
element.style.fontSize = '10px' // You can pass any CSS property here. Just make sure to change the property from mid-snake-case to lowerCamelCase.