'Save EventListener in webstorage
Is it possible to save EventListeners to webstorage?
var entity = document.createElement("a");
entity.addEventListener("click", function(e) {
play(path, this.id, "audio");
e.preventDefault();
});
function save() {
var playlist = document.getElementById("playlist");
localStorage.setItem("playlist", playlist.innerHTML);
localStorage.setItem("id", id);
}
This saves the element fine, but when the page is reloaded the listener is gone.
Solution 1:[1]
No, it definitely isn't. localStorage only stores strings, period.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Florian Margaine |
