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

137
Visualizações
Change cursor type for an html document from javascript js

Let's say I have a javascript method that takes a little to long to finish to go without any user feedback at all. In my case it's sorting the rows in a table element (all in the DOM; only takes too long if there are a lot of rows), but it might do anything. I want to show the "progress" cursor while it runs. Here is what I have currently, but I've tried several other things as well:

// SORT

document.body.style.cursor = "progress";
MyLongRunningMethod(); //blocks for 10-15 seconds before returning
document.body.style.cursor = "auto";
about 4 years ago · Juan Pablo Isaza
2 Respostas
Responde à pergunta

0

Have u tried Promise?maybe that can help u.

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise

const MyLongRunningMethod = function(){
            return new Promise((resolve,reject)=>{
                //...dosometing in here
                resolve() //while finish.use the resolve function
            })
        }
      document.body.style.cursor = "progress";
      MyLongRunningMethod().then(res => {
          document.body.style.cursor = "auto";
      }); //blocks for 10-15 seconds before returning

about 4 years ago · Juan Pablo Isaza Relatório

0

Try this below code;

document.body.style.cursor = "progress";
setTimeout(function(){
SortTable(cell.cellIndex, dir, sortType);
document.body.style.cursor = "auto";}, 10);
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