I need a javascript that can read the value of this:
<div id="timer" >07.45</div>
,it's a timer and it counts from 20 seconds, it counts down in seconds and miliseconds , so how can I get let's say 07.45 value to be shown! This is what I tried but it doesn't work, it shows undefined
<div id="timer">07.45</div>
<button onclick="myFunction()">Try it</button>
<p id="demo"></p>
<script>
function myFunction() {
var x = document.getElementById("timer").value;
document.getElementById("demo").innerHTML = x;}
</script>
divelements don't havevalues. You might want theinnerHtmlinstead.