So far I have this which replaces the text in the input box if it has the object name in it, with the object value:
var obj = {
'1': 'fish',
'q': 'apple',
'z': 'banana',
};
$("#inputBoxID").on("keyup", function() {
if(obj.hasOwnProperty($("#inputBoxID").val())) $(this).val(obj[$("#inputBoxID").val()]);
});
I would like to modify this so that on any occurrence of a object name it would replace the object name with the value, here's an example of what I'm trying to do:
User enters hello q I want that to be replaced with: hello apple
How would I go about doing this?
appleapple