Please note, this is a STATIC archive of website www.tutorialspoint.com from 11 May 2019, cach3.com does not collect or store any user information, there is no "phishing" involved.
Tutorialspoint

How to link jQuery from Google CDN?

I have set jQuery on local machine, but it’s cumbersome. I want to use CDN for the same purpose for faster loading of web page. Environment can be set for jQuery using Microsoft or Google CDN. How can I link jQuery from Google CDN, to avoid jQuery version to be placed on my local machine?


1 Answer
David Meador

To link jQuery from Google CDN, add the following in the srcattribute of the scripttag.

https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js

Here, we are using Google CDN version of the library. You can try to run the following code to learn how to use Google CDN to link jQuery.

Example

Live Demo

<html>
   <head>
      <title>jQuery CDN</title>
      <script src = "https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
      <script>
         $(document).ready(function() {
            document.write("Hello, World!");
         });
     </script>
   </head>
   <body>
      <h1>Hello</h1>
   </body>
</html>

Advertisements

We use cookies to provide and improve our services. By using our site, you consent to our Cookies Policy.