JSFiddle - React, Tailwind, and code Playground
HTML
<input type="text" />
JavaScript
var lookUpObject = {
h: 'html',
p: 'php'
};
$(document).ready(function() {
$('input').keypress(function (event) {
var result = lookUpObject [String.fromCharCode(event.which)];
if (result) {
var val = $(this).val();
$(this).val(val + result);
event.preventDefault();
}
})
});