Any way to detect a new line in a variable?
I 'm working on some more RTE stuff for my app and have a contenteditable div with a H1 inside (inherits contenteditable ) from the parent . When deleting content , it leaves behind the following value : "
"This is present after deleting all content , so I can 't prevent default (which is removal of the whole H1 element ) because the size of the variable containing the contain remains as 1 (that 's the check I 'm doing to prevent default ) . If I could detect it based on the value as above , I should then be able to prevent default . Make sense ? ✅1Cracked it - I think . If I make another check by getting the h1 element by id and get innerHTML and see if it equals <br> , it works and doesn 't remove the whole element as it did before . Weirdly , this was definitely not working yesterday , but is working now . 🤔 So , I daringly say "solved ? " just now . . . 👍1
.jpeg/public)