Jquery not loading in head but loading on bottom of body tag

后端 未结 5 1018
囚心锁ツ
囚心锁ツ 2020-12-12 07:42

Here is my problem: as title says, jQuery is working only when I put the scripts on the bottom of the body tag. When I put them in head they are not working. I am using just

5条回答
  •  被撕碎了的回忆
    2020-12-12 07:59

    if it works when the code is below body is that the items are already loaded, I do not know if you placed your code inside the jQuery ready function.

    example:

     $( document ).ready(function() {
      $( "p" ).text( "The DOM is now loaded and can be manipulated." );
    });
    

    source: http://api.jquery.com/ready/

提交回复
热议问题