JSFiddle - React, Tailwind, and code Playground

HTML

<div>
    <span id="test" class="productname" />
</div>
<br/>
<input type="text" id="CSSName" value="content" />

<button type="button" onclick="showCSS()" > show CSS </button>

<div id="info"></div>

CSS

.productname
{
    color: #f80;
    font-weight: bold;
    padding: 4px;
    border: 2px solid #888;
}

.productname:before
{
    content: "My Shiny New Product";
}

JavaScript

function showCSS()
{
    var Param = $("CSSName").value;
    
    var Value = $("test").getStyle( Param );
    
    $("info").innerHTML = Param + "=" + Value;
}