So I'm rendering dynamic items using replaceWith()
to replace elements inside a <div>
tag. However, whenever I use replaceWith()
, the element listeners in the initial load is wiped clean and need to be declared again. It's an okay way to ensure that the listeners still work but what if there were multiple listeners, manually copy pasting them is tedious. Is there a way to import or export jQuery event listeners?
Any insight would be much appreciated, thank you for reading.