phil
phil

Reputation: 2187

Render certain words/characters in text input

When displaying strings in an HTML Text Input or TextArea I would like certain substrings to render with a box around them. Ideally those substrings would then be treated as a single entity rather than individual characters or indeed the stackoverflow tags below. Rather like highlighting or text emphasis but maybe with graphics.

For example:

-------------------------------------------------------------|
|                      _______                               |
| This string contains |boxed| characters within a textarea. |
|                      -------                               |
--------------------------------------------------------------

Please note that I want to mix text and tags - not just display tags.

Upvotes: 0

Views: 211

Answers (1)

mmontoya
mmontoya

Reputation: 403

You cannot do that with a textarea. A workaround could be emulate this behaviour by using a div with a contenteditable=true attribute on it, then you can apply the needed style.

You can check docs here: https://developer.mozilla.org/en-US/docs/Web/Guide/HTML/Editable_content.

Upvotes: 1

Related Questions