jQuery Installation

Adding jQuery to Your Web Pages


You can install and use jQuery in your project in two main ways


  • Download the jQuery library from jQuery.com
  • Include jQuery from a CDN, like Google


1. Using jQuery via CDN


A CDN (Content Delivery Network) lets you include jQuery in your website without downloading it.


It loads jQuery from a remote server that's fast and globally distributed.


Include the jQuery <script> tag in your HTML file. You can place it inside the <head> or just before the closing </body> tag.

Example
<!DOCTYPE html>
<html>
<head>
<title>jQuery CDN Example</title>
<!-- jQuery from official CDN -->
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
</head>
<body>
<h2>Click the button</h2>
<button id="myButton">Click Me</button>
<script>
// jQuery code
$(document).ready(function() {
$("#myButton").click(function() {
alert("Button clicked!");
});
});
</script>
</body>
</html>

2. Download and Host jQuery Locally


When downloading jQuery, you'll find two versions available:


1. Compressed (Minified) Version

  • Filename: jquery-3.6.0.min.js
  • Use Case: Ideal for production websites
  • Why: Smaller file size → faster loading
  • Looks like: All code is squished into one line (not readable by humans)


2. Uncompressed (Development) Version

  • Filename: jquery-3.6.0.js
  • Use Case: Best for development and debugging
  • Why: Easy to read, with proper spacing and comments
  • Looks like: Regular JavaScript code with documentation


Visit the official download page:

👉 https://jquery.com/download/

You’ll see options to:

  • Download the compressed or uncompressed version
  • Copy the CDN link
  • Use jQuery with a package manager (like npm or yarn)


<script src="js/jquery-3.6.0.min.js"></script>

Whereisstuff is simple learing platform for beginer to advance level to improve there skills in technologies.we will provide all material free of cost.you can write a code in runkit workspace and we provide some extrac features also, you agree to have read and accepted our terms of use, cookie and privacy policy.
© Copyright 2024 www.whereisstuff.com. All rights reserved. Developed by whereisstuff Tech.