JSFiddle - React, Tailwind, and code Playground

HTML

<div id="elem-container">dummy</div>
<div id="output"></div>

CSS

#elem-container{
   position: absolute;
   left:     30px;
   top:      200px;
   height:   30px;
   color:blue;
 }

JavaScript

var elem1 = document.getElementById("elemId");
//var style = window.getComputedStyle(elem1, null);
var this_id = $('#elem-container').attr('id');
var style = window.getComputedStyle( document.getElementById(this_id), "")

// this is equivalent:
// var style = document.defaultView.getComputedStyle(elem1, null);



  function getTheStyle(){
    var elem = document.getElementById("elem-container");
    var theCSSprop = window.getComputedStyle(elem,null).getPropertyValue("color");
    document.getElementById("output").innerHTML = theCSSprop;
   }
  setInterval(function() { getTheStyle() }, 1000)