I am looking for something similar to what can be seen on the slack Help Center https://get.slack.help/hc/en-us/categories/200111606
They successfully done this, and it appears that each category description from there, has two or three random words which are bolded.
I've tried this:
//testing random words
var words = $('.blocks-item-description').text().split(' ');
// with help from http://stackoverflow.com/questions/5915096/get-random-item-from-array-with-jquery
var randomWord = words[Math.floor(Math.random()*words.length)];
// with more help from http://stackoverflow.com/questions/2214794/wrap-some-specified-words-with-span-in-jquery
$('.blocks-item-description').html($('.blocks-item-description').html().replace(new RegExp( randomWord, 'g' ),'<strong>'+randomWord+'</strong>'));
And tested it here: https://doculus.zendesk.com/hc/en-us (not my website) but I was not able to see the same result.
Any help is appreciated.
Thanks