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

246
Vistas
How to dynamically highlight changing numbers?

I have been searching for days now.

I have some random numbers that are generated automatically with crunch function on 3 minute interval:

setInterval(crunch, 180000);

then I can nicely highlight the return random numbers with mark.js:

$(function() {
        var mark = function() {
            // Read the keyword
            var keyword = $("input[name='keyword']").val();
            var keyword2 = $("input[name='keyword2']").val();
            // Remove previous marked elements and mark
            // the new keyword inside the context
            $(".context").unmark({
                done: function() {
                    $(".context").mark(keyword).mark(keyword2, {
                        className: 'secondary'
                    });
                }
            });
        };
        $("input[name^='keyword']").on("input", mark);
    });

My problem is when the second lot of new numbers are generated the highlight goes away - please can you kindly share a way how I can make them stay highlighted forever?

Here is my working fiddle on a 3 min interval:

https://jsfiddle.net/heybubbles/eztgy7j9/12/

min: 1 max: 100 results: 100

I tend to search for the highlighted number after generation not sure how to make it search on generation apologies.

Many thanks in advance!

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

if you change the keyword after the re-generating numbers it will re-highlight it. Don't appear to be a way to trigger mark manually and you have the change the input for it to re trigger, rather than use marksjs why not just do something like this

mark.js trigger event from selection

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