I am trying to detect text overflow in contenteditable
div, so that when text enter after the div width(800px), it will alert about the overflow. I am trying below code.
HTML
var e = document.getElementById('test');
if (e.offsetWidth < e.scrollWidth) {
alert("Overflow");
}
#test{
max-width: 800px;
text-overflow: ellipsis;
white-space: nowrap;
overflow:hidden;
font-size: 76px;
}
<div class="content" contenteditable="true">
<div id="test">Click here..</div>
</div>