Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Practical Web Development

You're reading from   Practical Web Development Learn CSS, JavaScript, PHP, and more with this vital guide to modern web development

Arrow left icon
Product type Paperback
Published in Jul 2015
Publisher
ISBN-13 9781782175919
Length 276 pages
Edition 1st Edition
Languages
Tools
Arrow right icon
Author (1):
Arrow left icon
Paul Wellens Paul Wellens
Author Profile Icon Paul Wellens
Paul Wellens
Arrow right icon
View More author details
Toc

Table of Contents (17) Chapters Close

Preface 1. The World Wide Web FREE CHAPTER 2. HTML 3. CSS 4. JavaScript 5. PHP 6. PHP and MySQL 7. jQuery 8. Ajax 9. The History API – Not Forgetting Where We Are 10. XML and JSON 11. MongoDB 12. Mobile First, Responsive Design with Progressive Enhancement 13. Foundation – A Responsive CSS/JavaScript Framework 14. Node.js A. Bootstrap – An Alternative to Foundation Index

Where to place the jQuery library on your page?


Not everyone agrees on what the right thing to do here is. There is always a concern about the amount of time it takes to load a file. There is going to be a difference if you put the statement in the <head> section of your document or right before the closing </body> tag to load the jQuery library - for example:

<script src="./js/jquery/jquery.js"></script>

The concern is the time it takes to load the library. I sometimes place everything that is a library, in other words, something that delivers functionality without actually doing anything, in the head section of the file. This means that the functionality will be loaded before the HTML.

You will always use jQuery in conjunction with your own JavaScript file, for example, mycode.js. This file will contain your jQuery lines of code inside the following:

$(document).ready(function(){
  }

All the code you put there will be executed after your page is loaded. As a consequence...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime