Hi clever people,
This answer was almost exactly what I needed.
After adding that fn, inline, at the top of my jQ code, I wrote this jQ lower down:
$(":contains(|)").each(function() {
replaceText('|', 'X');
});
This works, finding all pipe chars across the entire doc and replacing them with X.
However I wanted to replace all pipe chars in a particular div, not across the whole doc. So I changed to:
$("#mySpecificDiv:contains(|)").each(function() {
replaceText('|', 'X');
});
However, this still replaces all instances across the doc. I am sure I should be using the third option 'node' (see linked-to answer) to limit the scope, but I've tried and failed to find the right syntax.
Sorry that yet again, reading the books and trial and error and past experience has continued to thwart my efforts to master yet another stupidly simple jQ exercise and thanks in advance if you have time to show me what I am doing wrong.
Cheers, -Alan