Closed SchnoppDog closed 3 years ago
Okay I worked out the problem. The problem was that my event-driven object wasn't in the for-loop, thus only connecting to the last created element. Putting the event-driven object inside the for-loop where my pickr-object is solved the problem.
Your question
Hi, I have a question regarding the color-picker. With an input I create between 2 to 6 color-picker dynamically roughly like you described in this FAQ: https://jsfiddle.net/Simonwep/9ghk71c3/. Now I want that every element I create is created with only one picker-object like in the linked FAQ. Now I want that every picker-button has its own assigned event-driven picker. Is it possible to create 2 or more picker instances dynamically with only one picker-object, but those should be individually controllable. I.E:
Creating multiple elements with one picker-object:
Every created picker-element should only be event-driven by this
shufflePicker
-picker-object:If I am writing it like this only the last element I create can show me the console.log()-output. All the other elements before the last don't show any console.log()-output. Is there a way that I can dynamically create picker-elements which are all event-driven individually, but are only created and only driven with one picker-object?
I hope I have been able to present my problem clearly enough.
Your environment: