JSFiddle - React, Tailwind, and code Playground

HTML

<div id="placeholder"> 
</div>
<input type="text" id="key" />
<button type="button" id="clicker">Submit</button>

JavaScript

var data = {
    prop1: "The value of property 1!",
    prop2: "The value of property 2!",
    prop3: "The value of property 3!",
}

$('#clicker').on('click', function(){
    
    // Get the user input
    var input = $('#key').val(); 
    
    // Retrieve the property using the user input string
    var output = data[input];
    
    // Placeholder object
    var ph = $('#placeholder'); 
    
    if(typeof output === 'undefined'){
        // There is no property that matches the user input string
        ph.html('Oops that property doesnt exist!');
    }
    else{
        // There is a property, so lets write the value of it.
        ph.html(output);
    }
});