Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

138
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda