0
How do I get the value of a CSS attribute with JS?
I am trying this: var elemento = document.getElementById("circulo1"); var posicion_elemento = elemento.style.left; alert(posicion_elemento); but it doesn't work. It is showing me nothing, just blank.
1 ответ
0
<div class='lll' style="color:red"></div>
var t = document.getElementsByClassName('lll');
console.log(getComputedStyle(t[0]).color);