I note the following (Javascript removeEventListener not working) I found that details using the same function declaration for both the add and remove event listener calls... Also, this text
But i dont know that either answer my query..
I am not aware and see no reason for the document to be re-rendered for so presumably there is only a single event listenener bound to my function getCurrentElapsedTime()
However, I still cant get this to work.
document.addEventListener('DOMContentLoaded', getCurrentElapsedTime,true);
function getCurrentElapsedTime()
{
...
}
function eventFinished($eventFinish)
{// user has completed event...
document.removeEventListener('DOMContentLoaded', getCurrentElapsedTime,true);
}
When eventFinished is called.. the listener is still running...
In browser console : document.removeEventListener('DOMContentLoaded',getCurrentElapsedTime,true)
returns 'undefined'
Help would be appreciated as this has me banging my head against a wall.. thanks in advance
(For the record, ChatGPT also suggests this should work..!)