[js] about clearing timer, addEventListener event binding in timer

I wrote a timer to detect whether an element appears on the dom tree. If I detected it, I bound an event to the element, using addEventListener, and then I cleared the timer. However, the event bound to this element also failed. Is it because clearing the timer caused the called function to be destroyed in memory? If I insist on destroying the timer, is there any other way to ensure that the element listens for events properly?

    var timer = setInterval(() => {
       let dom = document.getElementsByClassName("ke-upload-file")[0]
        if (dom) {
            dom.addEventListener("change", function (e) {
                console.log("")
            })
            clearInterval(timer)
        }
    }, 1000)
Apr.01,2021

after looking at the code of the subject, I feel that there will be no problem. I don't worry about running it again. There is no problem indeed. Listener is always there!
can you see if your dom node has changed? this dom is no longer that dom.

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b362c0-2c00c.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b362c0-2c00c.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?