Looking to incorporate the CSS properties of a div into a JavaScript conditional statement.
Here is the CSS code snippet:
div.desc{
position:relative;
top:0px;
left:0px;
}
Now, attempting to retrieve and alert the 'top' property using JavaScript.
alert(document.getElementsByClassName('desc')[0].style.top)
However, receiving a blank return. Is there an error in my code? Can I actually access the CSS property of the div with the class 'desc' using JavaScript?