Move jQuery to the end of body tag?

前端 未结 7 723
星月不相逢
星月不相逢 2020-12-05 16:06

My friend read an article which mentioned that moving all JavaScript files to the end of the closing body tag (), will improve the performance of a

7条回答
  •  误落风尘
    2020-12-05 16:35

    Use unobtrusive javascript (adding event listeners to elements instead of onclik ="..." etc). Put all your .js files at the bottom of the body tag, with the main library (jQuery in this case) placed first, and everything will be fine. You can use a bundler like bundle fu

    You will see a big performance boost of loading your page.

提交回复
热议问题