I am working on a script that takes a users on screen selection (when they physically highlight text in the browser) and is supposed to manipulate that text.
This is what I am trying to do.
Take the selected text, search for the selected text in an original string and then wrap the text that is found in the original string with a certain HTML tag (<b>, <span>, <a>
)
I am using the jQuery.textselect plugin.
The part I can't figure out is how to manipulate the original text once the user selection has been found.
Example: If this text is shown on the screen: "HELLO WORLD"
The original text is HELLO WORLD, the user selects HELLO, then the script searches through the original text for the user selection and will wrap HELLO with <b>
tags and then output the new original text... make sense?
Sorry for the confusion and thanks for the help!