In my code I dont find the opacity for the div "box", if I call the function toggle it shows zero.
Why doesnt it shows 2 as it should because opacity is 1 and multiplied with 2.
Here is my code: jsFiddle
<html>
<head>
<style>
#box {
background-color:blue;
width:100px;
height:100px;
opacity:1;
}
</style>
</head>
<body>
<div id="box"></div>
<button onclick="toggle()">Toggle</button>
<script>
var faded = false;
var current = document.getElementById("box").style.opacity *2;
var toggle = function() {
document.getElementById("box").innerHTML = current;
}
</script>
</body>
</html>