The question is not clear. It's possible that you want edit not just text, but formatted text. Say, part of text would be bold, some other part have different font style of size, different indent, and so on.
Such editors are created based not on input control (what you call "textbox" is actually the
input element), but some element, such as
div
with the attribute
contenteditable
:
https://developer.mozilla.org/en-US/docs/Web/Guide/HTML/Content_Editable[
^],
https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/contentEditable[
^].
Such elements can be edited by the users. You can also have some controls which modify the style properties of the selected fragment of text using JavaScript. This is the way to developed the behavior like in other the formatted document editors.
This is a good example of one of such products: open-source TinyMCE:
https://en.wikipedia.org/wiki/TinyMCE[
^],
http://www.tinymce.com/[
^].
There are many more:
https://en.wikipedia.org/wiki/Comparison_of_HTML_editors[
^].
—SA