What is the earliest javascript / jquery method to run javascript ASAP?

Is there a way to execute multiple javascript lines before the document.ready event?

+4
source share
1 answer

Yes, just do not put it in a handler. If you need access to elements, the only way, as far as I know, is to place the <script> element after the elements it needs to receive in the document.

Here is a demo.

+8
source

Source: https://habr.com/ru/post/1389726/


All Articles