-1

I am trying to add a simple Bootstrap spinner in my HTML document. However, when I add in the code below it does not work. I tried adding a .show() in the JQuery but it still does not work. I am not sure what to do next in trying to troubleshoot. In the end I want to activate the spinner once a modal is opened by the user, and then once a process ends from an Ajax call then the spinner will terminate.

Bootstrap Spinner:

<div class="spinner-border text-success" role="status">
  <span class="sr-only">Loading...</span>
</div>

JQuery:

$('.spinner-border').show();

However, the above code does not work and does not even show anything.

kane_004
  • 193
  • 1
  • 10
  • Have you tried any debugging steps? If you do `$('.spinner-border').length`, what does it say? What styles are applied to the spinner? – Tyler Roper Jan 21 '20 at 21:27
  • `sr-only` https://stackoverflow.com/questions/19758598/what-is-sr-only-in-bootstrap-3 your "spinner" has been set to only show when your user has a "screen reader". Remove that class and try again. – freedomn-m Jan 21 '20 at 21:34

1 Answers1

1

<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css" integrity="sha384-Vkoo8x4CGsO3+Hhxv8T/Q5PaXtkKtu6ug5TOeNV6gBiFeWPGFN9MuhOf23Q9Ifjh" crossorigin="anonymous">

<div class="spinner-border" role="status">
  <span class="sr-only">Loading...</span>
</div>

<script src="https://code.jquery.com/jquery-3.4.1.slim.min.js" integrity="sha384-J6qa4849blE2+poT4WnyKhv5vZF5SrPo0iEjwBvKU7imGFAV0wwj1yYfoRSJoZ+n" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/popper.js@1.16.0/dist/umd/popper.min.js" integrity="sha384-Q6E9RHvbIyZFJoft+2mJbHaEWldlvI9IOYy5n3zV9zzTtmI3UksdQRVvoxMfooAo" crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/js/bootstrap.min.js" integrity="sha384-wfSDF2E50Y2D1uUdj0O3uMBJnjuUD4Ih7YwaYd1iqfktj0Uod8GCExl3Og8ifwB6" crossorigin="anonymous"></script>
anathema1998
  • 193
  • 5