4
4
4eloBek2015-08-02 11:54:07
JavaScript
4eloBek, 2015-08-02 11:54:07

How to find out what tags are already framed by the selected text?

I am making a visual html editor for a static site. Faced the problem of checking the selected text for the presence of tags framing it...
For example, there is formatted text. We selected "wor":
<b>Hello |wor|ld !!!</b>
Next, you need to undo the "influence" of these tags on it using js (without jQuery libraries, and also without execCommand, because I have unique tags there).
Thanks in advance)

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexey Ukolov, 2015-08-02
@alexey-m-ukolov

The most correct (in terms of the number of bugs and the complexity of development) way is to keep the syntax tree of the text in memory and work with it.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question