How would you get the currently selected text within a textarea (and modify it)?
I've seen the select event that can be listened for, but I was wondering if there was a way to just get the currently selected text.
Also, what technique do you need to use in order to be able to modify that specific section of text within the textarea? I assume there's some way of finding out what the position of the selection is within the contents of the textarea as a whole?
What I want to be able to do is take the selection and modify it, or wrap it in certain tags etc., like you are able to do in the stackexchange text editor.