When you type text in a contentEditable div that contains a <br> tag in Internet Explorer 11 or Microsoft Edge, the <br> tag is deleted unexpectedly. This behavior occurs in a contentEditable div that hosts content that's separated by a <br> tag.
For example, assume that you select Line2 in the following sample HTML and then type asdf:In this situation, not only is Line2 deleted but also the following <br> tag. Therefore, Line3 joins the text that you typed ("asdf") in Line2, as follows:Note This issue occurs if one of the following conditions is true:
For example, assume that you select Line2 in the following sample HTML and then type asdf:
<div contenteditable="true">
<span>
Line1
<br>
Line2
<br>
Line3
<br>
Line4
</span>
</div>
<div contenteditable="true">
<span>
Line1
<br>
asdfLine3
<br>
Line4
</span>
</div>
- You press Shift+End to select the line where you'll enter the text.
- You use the mouse pointer to click just before the <br> tag to select the location for entering the text.