jQuery contains all the common DOM, event, effects, and Ajax functions. jQuery’s syntax is concise and makes use of variables in the form of CSS selectors as a way of connecting an effect with any targeted element of the DOM, be it a unique element (id), or set of elements (class), or arbitrarily chosen.
We will include the latest (for April 2017 it’s a v3.2.1) jQuery library to our website. For this we need to find the file of our project that is responsible for the HEAD section of our website. Depending on your website platform (WordPress, Joomla, Jekyll, and etc) this file may have the name such as
default.html, or another name. Then we place the following code before the closing
</head> tag in this file:
This will ensure that the jQuery library will be loaded from the Google CDN (Content Delivery Network) and included to every page of our website.
In the code line above we do not have the
Place your jQuery
<script>tag before any other
<style>tags inside the
And here is an example of a web template with the jQuery
<script> tag included:
<!doctype html> <html> <head> <title>Your Project</title> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script> <link rel="stylesheet" type="text/css" href="style.css"> </head> <body> ... </body> </html>
Done! Now we can begin adding jQuery functionality to our website.
Thanks for reading!