Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

340
Visualizações
Stop CSS loader spinning if form validation error, django, javascript

How do I stop the loader spinner showing if the form submit fails and the user has to complete a missing form field. The spinner keeps spinning forever while the user enters the missing information.

My submit button in the form:

...
  <div class="control">
    <button type="submit" class="button" onclick="showDiv()">Submit
    </button>
  </div>
</form>

My spinning loader below the form:

<span class="loader" id="loadingdisplay" style="display:none;"></span>

My javascript on click event to display spinning loader:

<script type="text/javascript">

        function showDiv() {
           document.getElementById('loadingdisplay').style.display = "block";
        }

</script>
about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

You can add a listener on your form or your field that will hide your loader.

<script>
var x = document.getElementById("myInputField");
x.addEventListener("focus", myFunctionHideDiv);


function myFunctionHideDiv() {
  document.getElementById('loadingdisplay').style.display = "None";
}
</script>

Ressources :

  • EventListener documentation
  • Event documentation
about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda