I'm attempting to format the text in an contenteditable div after Enter is pressed. The problem is that no keyups are being registered from any key, so this is making it impossible. Other events, such as 'click' does work, and if I change the element to 'document' (document.addEventListener()...) this will make it work too, but this is an extreme solution. Is there a simple solution?
window.addEventListener('load', function() {
var editbox = document.getElementById("editable")
editbox.addEventListener('keyup', function(e) {
alert("this should appear");
});
});
<main contenteditable="true">
<div class="box" id="editable">
text
</div>
</main>