Why is document.GetElementById returning null [duplicate]

You can use the script tag like this:

<script defer>
    // your JavaScript code goes here
</script>

The JavaScript will apply to all elements after everything is loaded.

Leave a Comment