I have a dom element like this.
<div class="MyClass" id="123" style="width: 228px; overflow: auto; height: 100px;">
<div class="loading-indicator">loading...</div>
</div>
I want to take a width from tag div
which is 228 and store in some variable which I can use later.
var st = 228px; // dynamically
Here I wanted to use.
var secondDiv = document.createElement('div');
secondDiv.style = "background-color:#2C8DC2;color:white;padding:5px; margin-top:102px;height: 50px; width : st; border-style: solid;";
Now What I am trying here is :
var abc = firstDiv.getAttribute('style');
I am getting : "width: 228px; overflow: auto; height: 100px;"
abc.width;
But this is coming undefined.
How to fetch that value.