JSFiddle - React, Tailwind, and code Playground
HTML
<input type='text' onkeyup='check(event);' id='in' />
<div id='out' ></div>
JavaScript
function check(e){
var text = e.keyCode ? e.keyCode : e.charCode;
switch(text){
case 81:
text = 'መ';
break;
case 87:
text = 'ሙ';
break;
case 69:
text = 'ሚ';
break;
case 82:
text = 'ማ';
break;
case 84:
text = 'ሜ';
break;
case 89:
text = 'ም';
break;
case 85:
text = 'ሞ';
break;
}
if(text == 8){
var str = document.getElementById("out").innerHTML;
var foo = str.substring(0, str.length -1);
document.getElementById("out").innerHTML = foo;
}else {
document.getElementById("out").innerHTML += text;
}
}