web-padawan / vanilla-colorful

A tiny color picker custom element for modern web apps (2.7 KB) 🎨
https://web-padawan.github.io/vanilla-colorful/
MIT License
784 stars 29 forks source link

Multiple Colorful instances on same page #66

Closed robertdrakedennis closed 2 years ago

robertdrakedennis commented 2 years ago

Hi there! I currently writing a simple reusable blade component in my project and I'm having a difficult time trying to have multiple colorful instances work. What would be your strategy on this?

Example of what component: https://gist.github.com/robertdrakedennis/35461b629722c2adbbe0c1938c4178d8

Reidond commented 2 years ago

hi, you could do this document.querySelectorAll('hex-color-picker');

and apply event listener to every htmlelement in array

web-padawan commented 2 years ago

Hi, thanks for the answer. This is indeed a correct way to do it.