JSFiddle - React, Tailwind, and code Playground

HTML

<input type="text" id="input1" onkeydown="if (event.keyCode == 13) getParameters()" value="class=xxx&color=red" /> Press Enter
<div id="ccc">
<div id="test_div">src+color</div>
</div>
<div id="monitor_test_div">monitor_test_div</div>

CSS

.xxx {background-color: grey;}
input {width: 250px;}
#test_div {
    border: 1px solid rgb(160, 160, 160);
    display: inline-block;
    margin: 5px 0px 4px 1px;
    padding: 1px 8px;
    font-size: 20px;
    font-weight: bold;
}
br {
    display: none;
}

JavaScript

function getParameters() {
  var searchString = document.getElementById('input1').value,
      params = searchString.split("&"),
      hash = {};

  if (searchString == "") return {};
  for (var i = 0; i < params.length; i++) {
    var val = params[i].split("=");
    hash[unescape(val[0])] = unescape(val[1]);
  }
    console.log(hash);
  //return hash;
    
  if(val[0] == "class"){ //alert(val[1]); 
    $.each(hash, function( attribute, value ) {
      test_div.setAttribute(attribute,value);
    });
  }
  else if(val[0] == "color"){ //alert(val[1]); 
    $.each(hash, function( attribute, value ) {
      test_div.style[attribute]=value;
    });
  }

    
  monitor_test_div.innerText = ccc.innerHTML;  
}