I have seen many questions related to div tag with contenteditable attribute, but my problem is a bit different.
I don't care whether hitting enter and adding new lines adds <div>
or <br>
, but when I select all the text by hitting CTRL + A and then clearing it by pressing DEL or BACKSPACE, it adds additional <br>
. But when text is only in one line, selecting and clearing it leaves nothing.
How can I avoid the situation when clearing many lines of text adds additional <br>
tag?