A collection of little plugins to make text manipulation easier in jQuery.This code is beta, and has been tested in IE 7, FF 2, Safari 2, and Opera 9.

textNodes(deep)

returns each of the text nodes of a jQuery as a jQuery object of the textNodes. Searching deeply or the default shallow. Compare to text() which returns them as a string. These textNodes can be separately wrapped and css'ed or filtered or SOME of the other jQuery methods. To better explain these nodes, you need to view source this page to see how I have used them.

replace(regularExpression,replacement)

looks like the String function replace, and attempts to mimic it, but it happens right in the dom! Either on a textNodes or a normal jQuery.

split(OptionalRegularExpression)

looks like the String function split, and attempts to mimic it, but it happens right in the dom, in a textNode. Care should be taken using your own OptionalRegularExpression, because anything that does not return the split delimiters as part of the split will be lost.

span()

converts a textNode into a normal jQuery <span> node, for further jQuery usage.

acronyms(acronymsHash)

runs through the jQuery wrapping some words with <acronym title="sometext">

match(regularExpression)

runs through the jQuery returning the portions of the text nodes that match the regularExpression.


Original Now and then or maybe later
silly replace #1
then made red, and later changed to never
Now and then or maybe later
should be the same as Now and then or maybe never
silly replace #2
or inside <i> changed to and
Now and then or maybe later
should be the same as
Now or then or maybe later
silly replace #3
or inside <i> changed to and . simpler
Now and then or maybe later
should be the same as Now or then or maybe later

green room
'green', 'hooked', and 'words' become green

Certain words are made green, they have been hooked!

italic caps
capital letters become italicized!

Certain words, that start with a Capital letter are made italic. As in my name Jake Wolpert.