Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

239
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!