JSFiddle - React, Tailwind, and code Playground

HTML

<html lang="en">

    <head>
        <title>Document</title>
        <style>
            #dd{
                height: 300px;
                width: 300px;
                background-color: mediumblue;
                color: white;
            }

        </style>
    </head>

    <body>
        <label>Color </label><input id="in1" type="text">
        <hr>

        <div id="dd">
    </div>

        <script>
            var colorTextBox = document.getElementById("in1");
            var div = document.getElementById("dd");

            div.onclick = function(){
                colorTextBox.value = getComputedStyle(div).backgroundColor;
        alert(getComputedStyle(div).backgroundColor);
            }

        </script>
       
    </body>
</html>