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