MOCKSTACKS
EN
Questions And Answers

More Tutorials









Jquery Include script tag in head of HTML page


To load jQuery from the official CDN, go to the jQuery website. You'll see a list of different versions and formats available.
The best practice is to load any external JavaScript libraries at the head tag with the async attribute. Here is a demonstration:

<!DOCTYPE html>
 <html>
 <head>
 <title>Loading jquery-2.2.4</title>
 <script src="https://code.jquery.com/jquery-2.2.4.min.js" async></script>
 </head>
 <body>
 <p>This page is loaded with jquery.</p>
 </body>
 </html>

When using async attribute be conscious as the javascript libraries are then asynchronously loaded and executed as soon as available. If two libraries are included where second library is dependent on the first library is this case if second library is loaded and executed before first library then it may throw an error and application may break.


Conclusion

In this page (written and validated by ) you learned about Jquery Include script tag in head of HTML page . What's Next? If you are interested in completing Jquery tutorial, your next topic will be learning about: Jquery Object.



Incorrect info or code snippet? We take very seriously the accuracy of the information provided on our website. We also make sure to test all snippets and examples provided for each section. If you find any incorrect information, please send us an email about the issue: mockstacks@gmail.com.


Share On:


Mockstacks was launched to help beginners learn programming languages; the site is optimized with no Ads as, Ads might slow down the performance. We also don't track any personal information; we also don't collect any kind of data unless the user provided us a corrected information. Almost all examples have been tested. Tutorials, references, and examples are constantly reviewed to avoid errors, but we cannot warrant full correctness of all content. By using Mockstacks.com, you agree to have read and accepted our terms of use, cookies and privacy policy.