Possible Duplicate:
Highlight text range using JavaScript
Find text string in jQuery and make it bold
Supposing I have a bunch of file paths, similar to:
/Volumes/A//Array/05_SCRIPTS/staging/tree/04_OUTPUTS/MPEG_FF_PS_wCropping/01_NBC_Youtube/Backlog/Archive/LawAndOrder_S20
/Volumes/A//AArray/05_SCRIPTS/staging/tree/04_OUTPUTS/MPEG_FF_PS_wCropping/01_NBC_Youtube/Backlog/Archive/LawAndOrder_S20/nbcnetwork-pds-E8818-US-insert-20121020
How would I highlight all matches of specific text on the page. For example, if "04"
was what I was looking for, it would do something like:
$(source).find('04').addClass('highlight');
This is pseudocode that is probably way off the mark, but this is what I'm looking to do.
http://jsfiddle.net/Aku4y/
var t = $(source).html();
t = t.replace(/04/g, "<span class='highlight'>04</span>");
$(source).html(t);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With