Can somebody help me please?
I would like to replace ‘text’ words with ‘TEXT’ just 3 times, how this can be done?
$('#test *').replaceText( /\btext\b/gi, 'TEXT' );
That is example #1 on this page
http://benalman.com/code/projects/jquery-replacetext/examples/replacetext/
Even If I delete ‘g’ modifier noting happens, still all ‘text’ words are replaced with ‘TEXT’
replaceText doesn’t work that way. It loops over all the child textnodes, and replaces the text in them. If you remove the “g”, it replaces only the first instance of text, but it does so in every child textnode. I don’t know if there’s a way to limit the number of replacements in javascript if you use g, but I don’t think so, so you’ll need to do it manually.