Why does the javascript style property not work as expected?

Posted by dramasea on Stack Overflow See other posts from Stack Overflow or by dramasea
Published on 2013-06-25T16:14:28Z Indexed on 2013/06/25 16:21 UTC
Read the original article Hit count: 215

Filed under:
<html>
<head>
<style type="text/css">
#wow{
    border : 10px solid red;
    width: 20px;
    height: 20px;

}
</style>
</head>
<body>
<div id="wow"></div>
<script>
var val = document.getElementById("wow");
alert(val.style.length);
</script>
</body>
</html>

This is my code, why is val.style.length 0? Because I defined 3 properties, I expected it to be 3

© Stack Overflow or respective owner

Related posts about JavaScript