Get started with jquery-compat CDN

MIT licensed

JQuery-compat: a lightweight, backward-compatible jQuery version for older browsers.

Tags:
  • jquery
  • javascript
  • browser
  • library

Stable version

Copied!

How to start using jquery-compat CDN


<!DOCTYPE html>
<html>
<head>
    <title>Get started with jquery-compat CDN - cdnhub.io</title>
    <script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
    <!-- Include jquery-compat CDN -->
    <script src="https://cdn.cdnhub.io/jquery-compat/3.0.0-alpha1/jquery.min.js"></script>
    <script src="script.js"></script>
</head>
<body>
    <!-- Your HTML content goes here -->
</body>
</html>

// script.js
$(document).ready(function() {
    // Use jQuery-compat functions
    $.compat.map([1, 2, 3], function(value, index, array) {
        console.log('Original:', value);
        console.log('Rounded:', Math.round(value * 10) / 10);
        return Math.round(value * 10) / 10;
    });

    // Use regular jQuery functions
    $('button').click(function() {
        $('p').text('Button clicked!');
    });
});
Copied!
Copied!
Copied!

All versions