Calling the preventDefault method in the compositionend event has no effect

Viewed 189

var tempNode = document.getElementById('view_1');
tempCNode.addEventListener('compositionend', function(e) {
  console.log(e.cancelable); // true
  e.preventDefault();
});
<div id="view_1" class="view" contenteditable="true">
  <p>
    <br>
  </p>
</div>

I want to get the value of the input method and not let it display directly in the div.

What should I do?

Thanks

0 Answers
Related