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

243
Visualizações
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 Respostas
Responde à pergunta

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 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