I am using jQuery, when numeric values enter in inputbox e.g. 1234 it converts those into ABCD respectively. But I want to convert this jQuery function into pure Javascript. Please take a look at my jQuery code that is working perfectly fine and suggest how can I convert it into Javascript (I am also confused why it is always taking me at the last typed alphabet, if I type in the middle?).
$(document).ready(function(){
$('input[name="xrd-reference"]').bind("change keyup input",function() {
$('input[name="xrd-reference"]').val($('input[name="xrd-reference"]').val().replace(/1/g, 'A').replace(/2/g, 'B').replace(/3/g, 'C').replace(/4/g, 'D').replace(/5/g, 'E').replace(/6/g, 'F').replace(/7/g, 'G').replace(/8/g, 'H').replace(/9/g, 'I').replace(/0/g, 'O'));
});
});
<input name='xrd-reference'>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>