JSFiddle - React, Tailwind, and code Playground

by Anov Siradj

HTML

<div id=i>money ...</div>
<div id=o></div>

JavaScript

var a = document.querySelector('#i');
var b = document.querySelector('#o');

a.contentEditable = true;

a.addEventListener('keypress', function(event) {
	if(/Enter/.test(event.key)) {
  	event.preventDefault();
  	this.blur();
    return;
  }
});

a.addEventListener('blur', function(event) {
  this.innerText = 'YEET!';
});

a.addEventListener('input', function(event) {
	b.innerText = this.innerText.replace(/[^0-9]+/g, '');
});