Get started with jQuery.my CDN

MIT licensed

JQuery.my: custom namespace for functions, plugins.

Tags:
  • MVVM
  • framework
  • ui
  • form
  • validation
  • data binding
  • jquery-plugin
  • ecosystem:jquery

Stable version

Copied!

How to start using jQuery.my CDN


// Assuming you have the following HTML structure
<!DOCTYPE html>
<html>
<head>
  <title>Get started with jQuery.my CDN - cdnhub.io</title>
  <script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
  <script src="https://cdn.cdnhub.io/jQuery.my/1.2.14/jquerymy.min.js"></script>
  <script src="script.js"></script>
</head>
<body>
  <button id="myButton">Click me!</button>
  <div id="myDiv"></div>
</body>
</html>

// In your script.js file
(function($) {
  $.fn.myPlugin = function() {
    this.click(function() {
      $(this).next('#myDiv').toggle();
      $(this).text(function(i, text) {
        return text === 'Click me!' ? 'Hide' : 'Click me!';
      });
    });
  };

  $(function() {
    $('#myButton').myPlugin();
  });
})(jQuery);
Copied!
Copied!

All versions