jQuery
v4.0.0Fast, small library for DOM traversal, event handling and Ajax.
Quick start
Add this tag to your page. Place it just before the closing </body> tag, or in the <head> with the defer attribute.
HTML
<script src="https://jscdns.net/libs/jquery/4.0.0/jquery.min.js"
integrity="sha384-fgGyf7Mo7DURSOMnOy7ed+dkq5Job205Gnzu6QIg0BOHKaqt4D76Dt8VlDCzcMHV" crossorigin="anonymous"></script>Files
| File | Size | Copy |
|---|---|---|
| jquery.min.jsScript | 76.9 KB | |
| jquery.slim.min.jsScript | 54.7 KB | |
| jquery.module.min.jsES module | 76.8 KB |
Usage
Complete example
A minimal page that loads jQuery and uses it. Copy it into a file and open it in your browser.
example.html
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
</head>
<body>
<button id="greet" class="btn">Say hello</button>
<p id="output"></p>
<script src="https://jscdns.net/libs/jquery/4.0.0/jquery.min.js"
integrity="sha384-fgGyf7Mo7DURSOMnOy7ed+dkq5Job205Gnzu6QIg0BOHKaqt4D76Dt8VlDCzcMHV" crossorigin="anonymous"></script>
<script>
$(function () {
$('#greet').on('click', function () {
$('#output').text('Hello from jQuery ' + $.fn.jquery);
});
});
</script>
</body>
</html>Using the ES module build
If your page already uses <script type="module">, you can import the module build directly instead of relying on a global variable.
module.html
<script type="module">
import { $ } from 'https://jscdns.net/libs/jquery/4.0.0/jquery.module.min.js';
$('#output').text('Loaded as an ES module');
</script>Good to know. Version 4 drops support for Internet Explorer and older Edge. The slim build leaves out the Ajax and effects modules.