SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Addict revlimiter's Avatar
    Join Date
    Sep 2005
    British Columbia, Canada
    0 Post(s)
    0 Thread(s)

    Bottom jQuery Insertion

    I am noticing that jQuery can be inserted at the bottom of the page. Does this include all jQuery plugins too or will some need to be included at the top within the <head> tag?

    And is it to do with an improvement in page load speed that jQuery is added last? I have always wondered, and I do use jQuery quite a bit, so I am finally getting around to asking.

    "To make an apple pie from scratch,
    you must first create the universe.
    -Carl Sagan

  2. #2
    Programming Since 1978 silver trophybronze trophy felgall's Avatar
    Join Date
    Sep 2005
    Sydney, NSW, Australia
    25 Post(s)
    1 Thread(s)
    All JavaScript that is going to interact with the page should be attached at the bottom. Only JavaScript that is redirecting to another page without waiting for this one to load needs to go in the head. Since JQuery is written in JavaScript the bottom of the page is the correct place to attach it.
    Stephen J Chapman, Book Reviews, follow me on Twitter
    HTML Help, CSS Help, JavaScript Help, PHP/mySQL Help, blog
    <input name="html5" type="text" required pattern="^$">


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts