JSFiddle - React, Tailwind, and code Playground

HTML

<input class="val" value="red"/>

JavaScript

var color = {
                red : '#ff0000',
                black : '#000000',
                silver : '#7d8989'
            };

var currentColor = $(".val").val();

alert(color[currentColor]);