Back to articles
July 10, 2024
error, eventlistener, null

Resolve JavaScript error 'cannot add EventListener of null'

this was causing an error 'cannot add EventListener of null', until I moved the script tag in index.html to after the element I was listening for

document.getElementById("submit").addEventListener('click', function (e) {
  postRequest(e, 'audit');
});
Loading comments...