Search results

  1. T

    JavaScript function run without being called

    No problem, buddy! Glad I could help :thumbsup:
  2. T

    JavaScript function run without being called

    What happens when you use the `once` option? document.addEventListener("DOMContentLoaded", (event) => //runs after page fully loaded getRandomNumber(); alert("DomContentLoaed"); }, {once: true});
  3. T

    JavaScript function run without being called

    Is the submit button in a form? If so, it could be that pressing the submit button causes a page reload, which calls the `DOMContentLoaded` event to fire a second time.
Top Bottom