Skip to content

Instantly share code, notes, and snippets.

@ohiosveryown
Last active February 15, 2021 17:35
Show Gist options
  • Save ohiosveryown/885d33bf00c464c8480000a79c9bcd89 to your computer and use it in GitHub Desktop.
Save ohiosveryown/885d33bf00c464c8480000a79c9bcd89 to your computer and use it in GitHub Desktop.
Target / Get multiple elements
/*
<ul class="parent">
<li class="children"></li>
<li class="children"></li>
<li class="children"></li>
</ul>
*/
const parent = document.querySelector('.parent')
const children = document.querySelectorAll('.children')
parent.addEventListener('mousedown', () => {
children.forEach ((children) => {
children.style.transform = 'scale(.95)'
})
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment