JSFiddle - React, Tailwind, and code Playground

by ranadheemachineni

HTML

<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.2.0/jquery.min.js"></script>
<select id="select_data">
  <option value="">Choose one..</option>
  <option value="1">Value 1</option>
  <option value="2">Value 2</option>
</select>
<div class="content">
  <div id="spinner">
    <div style="color: #79bbb5" class="la-ball-spin-fade la-2x">
      <div></div>
      <div></div>
      <div></div>
      <div></div>
      <div></div>
      <div></div>
      <div></div>
      <div></div>
    </div>
  </div>
  <br>
  <div id="text"></div>
</div>

CSS

/*!
 * Load Awesome v1.1.0 (http://github.danielcardoso.net/load-awesome/)
 * Copyright 2015 Daniel Cardoso <@DanielCardoso>
 * Licensed under MIT
 */
.la-ball-spin-fade,
.la-ball-spin-fade > div {
    position: relative;
    -webkit-box-sizing: border-box;
       -moz-box-sizing: border-box;
            box-sizing: border-box;
}

.la-ball-spin-fade {
    display: block;
    font-size: 0;
    color: #fff;
}

.la-ball-spin-fade.la-dark {
    color: #333;
}

.la-ball-spin-fade > div {
    display: inline-block;
    float: none;
    background-color: currentColor;
    border: 0 solid currentColor;
}

.la-ball-spin-fade {
    width: 32px;
    height: 32px;
}

.la-ball-spin-fade > div {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 8px;
    height: 8px;
    margin-top: -4px;
    margin-left: -4px;
    border-radius: 100%;
    -webkit-animation: ball-spin-fade 1s infinite linear;
       -moz-animation: ball-spin-fade 1s infinite linear;
         -o-animation: ball-spin-fade 1s infinite linear;
            animation: ball-spin-fade 1s infinite linear;
}

.la-ball-spin-fade > div:nth-child(1) {
    top: 5%;
    left: 50%;
    -webkit-animation-delay: -1.125s;
       -moz-animation-delay: -1.125s;
         -o-animation-delay: -1.125s;
            animation-delay: -1.125s;
}

.la-ball-spin-fade > div:nth-child(2) {
    top: 18.1801948466%;
    left: 81.8198051534%;
    -webkit-animation-delay: -1.25s;
       -moz-animation-delay: -1.25s;
         -o-animation-delay: -1.25s;
            animation-delay: -1.25s;
}

.la-ball-spin-fade > div:nth-child(3) {
    top: 50%;
    left: 95%;
    -webkit-animation-delay: -1.375s;
       -moz-animation-delay: -1.375s;
         -o-animation-delay: -1.375s;
            animation-delay: -1.375s;
}

.la-ball-spin-fade > div:nth-child(4) {
    top: 81.8198051534%;
    left: 81.8198051534%;
    -webkit-animation-delay: -1.5s;
       -moz-animation-delay: -1.5s;
         -o-animation-delay: -1.5s;
           ...

JavaScript

$('.la-ball-spin-fade').hide();
 $("#select_data").change(function() {
   // I want to show the spinner when I change select value before load the 
   $('.la-ball-spin-fade').show();
   setTimeout(function(){
    $('.la-ball-spin-fade').hide();
   alert("Ajax success");
   
   }, 2000);
 });