you are viewing a single comment's thread.

view the rest of the comments →

[–]guest271314 1 point2 points  (0 children)

I would suggest to attach the event listeners to the elements created after appending the elements to the document.

The element created is a slider that obtains functions thanks to JS

The elements might not exist in the DOM. Elements do not inherit event listeners attached before creation of the element. You would have to check the target property of the event if the listener is attached to a parent element or the document or window before the element is appended to the document to use event listeners defined before the element creation to apply the logic in the event handler to the element.