document.querySelector('div[contenteditable="true"]').addEventListener('input', function() {
if (this.innerHTML != this.innerText) {
this.innerHTML = this.innerText;
var range = document.createRange();
range.selectNodeContents(this);
range.collapse(false);
var sel = window.getSelection();
sel.removeAllRanges();
sel.addRange(range);
}
});