As a popular JavaScript library jQuery is provided by different companies via CDN. Google CDN is one of the most popular jQuery CDN which provides reliable access to the jQuery libraries for different versions. In this tutorial, we will examine how to add jQuery Google CDN.
jQuery Types
As a complext and popular JavaScript library the jQuery is provided in different types.
- jquery.js is the most popular and standard jQuery library with all functions included.
- jquery.min.js is the same library with the jquery.js where it is minified.
- jquery.slim.js provides less functions where only popular and core functions are included.
- jquery.slim.min.js is the minified versions of the jquery.slim.js.
Add jQuery Google CDN
The jQuery Google CDN can be added by using the <script> tags and providing the Google CDN address as the src attribute. The jquery.js can be added like below. Google CDN provides the jQuery via ajax.googleapis.com domain.
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
</head>
Add Minified jQuery via Google CDN
Minified version of the jQuery can be added via the Google CDN like below.
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
</head>
Add Slim jQuery via Google CDN
Slim version of the jQuery can be added via the Google CDN like below.
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.slim.js"></script>
</head>
Add Minified and Slim jQuery via Google CDN
Both minified and slim version of the jQuery can be added via the Google CDN like below.
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.slim.min.js"></script>
</head>