I would like to Find word on page, wrap in span tags with class. before proceeding to execute a javascript i have almost got ready.
If i can work out how to just do this first part i think i can get the rest.
Find word on page, wrap in span tags with a class applied to the span tags.
Must then be searchable via:
$(document).ready(function(){
var injectionKey = /%id=inject%/ig;
var injectionStack = $('#%id%').html();
(function($) {
var theInjectionPage = $("span.myclass");
theInjectionPage.html(theInjectionPage.html().replace(injectionKey, injectionStack));
})(jQuery)
});
Do not use regex. Do not replace large chunks of
innerHTML. Do not pass Go. Do not collect $200.Walk over the text nodes only, finding the target text and splitting to insert new elements. See this question for example code using an
<a>.