How do you use a cdn to host jQuery?

Advertisements

I always use the code from the jQuery site in my code to use jQuery, and I have recently heard about using a cdn. How do I use one?

>Solution :

A content delivery network CDN refers to a geographically distributed group of servers that work together to provide fast delivery of Internet content.

<!DOCTYPE html>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<script>
$(document).ready(function(){
  $("button").click(function(){
    $("p").hide();
  });
});
</script>
</head>
<body>

<h2>This is a heading</h2>

<p>This is a paragraph.</p>
<p>This is another paragraph.</p>

<button>Click me</button>

</body>
</html>

Leave a ReplyCancel reply