Answer the question
In order to leave comments, you need to log in
All js files are included at the end of the body, but the script is initialized at the beginning, what should I do?
All files are connected at the bottom, and the script starts at the beginning of the document. What options are there besides raising all scripts to the top in head?
Answer the question
In order to leave comments, you need to log in
Move the script itself to the end in a separate file. You can even inline, but after the rest of the scripts.
The second option is to omit the script initialization at the end of the document =) And this is preferable to the
Third option - wrap it inwindow.onload = function ()
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question