Es5 getting started in EJ2 JavaScript Spinner control

8 May 20232 minutes to read

Initialize the Spinner using createSpinner method and show/hide the spinner using showSpinner and hideSpinner methods accordingly. Set the target to the spinner to render it based on specific target.

  createSpinner({
    target: document.getElementById('container')
  });
  • Show and hide this spinner by using showSpinner and hideSpinner methods for loading in your page.

Create the Spinner globally

The Spinner can be render globally in a page using public exported functions of the ej.popups.

//createSpinner() method is used to create spinner

ej.popups.createSpinner({

  // Specify the target for the spinner to show

  target: document.getElementById('container')

});

//showSpinner() will make the spinner visible

ej.popups.showSpinner(document.getElementById('container'));

setInterval(function () {

  //hideSpinner() method used hide spinner 

  ej.popups.hideSpinner(document.getElementById('container'))

}, 100000);
<!DOCTYPE html><html lang="en"><head>
    <title>EJ2 Spinner</title>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="description" content="TypeScript NumericTextBox Component">
    <meta name="author" content="Syncfusion">
    <link href="https://cdn.syncfusion.com/ej2/27.2.2/ej2-base/styles/material.css" rel="stylesheet">
    <link href="https://cdn.syncfusion.com/ej2/27.2.2/ej2-popups/styles/material.css" rel="stylesheet">
    
    
<script src="https://cdn.syncfusion.com/ej2/27.2.2/dist/ej2.min.js" type="text/javascript"></script>
<script src="https://cdn.syncfusion.com/ej2/syncfusion-helper.js" type ="text/javascript"></script>
</head>
<body>
    <div id="container">
       
    </div>

<script>
var ele = document.getElementById('container');
if(ele) {
  ele.style.visibility = "visible";
}   
      </script>
<script src="index.js" type="text/javascript"></script>
</body></html>