Get started with jquery.activity-indicator CDN

MIT licensed

Plugin: jQuery.activityIndicator displays custom indicator during AJAX requests.

Tags:
  • jquery
  • loader
  • indicator

Stable version

Copied!

How to start using jquery.activity-indicator CDN


$(document).ready(function() {
  // Select the button and the indicator element
  const $button = $('#myButton');
  const $indicator = $('#myIndicator');

  // Attach the activity indicator to the button
  $button.activityIndicator({
    size: 'large', // or 'small'
    message: 'Loading...' // or custom message
  });

  // Attach a click event to the button and toggle the indicator
  $button.click(function() {
    $button.activityIndicator('start'); // Start the indicator

    // Perform an AJAX call or other long-running task here
    $.get('https://example.com/api/data', function(data) {
      console.log(data);
      $button.activityIndicator('stop'); // Stop the indicator
    });
  });
});
Copied!
Copied!

All versions