Why does the javascript style property not work as expected?
- by dramasea
<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