0
<span style="margin-left:13%;" id="temporizador">Loading...</span>
<div id="roda"></div>
<div id="ponteiro"><b style="margin-left:15%; margin-top:500px; font-size:16px;">|</b></div>
<script>
setInterval(function(){
$.getJSON("loading.php", function(diego) {
var loja = diego[0];
var temporizador = diego[1];
document.getElementById('#temporizador').value = temporizador;
if(temporizador === "00"){
var img = document.querySelector('#roda');
var graus = Math.random() * 1000;
img.style.transform = 'rotate(' + graus + 'deg)';
}
});
}, 1000);
</script>
Why is the timer not replacing the value in the div with id timer? What is wrong?
I am very lay in javascript, but try to do the following: Instead of putting
document.getElementById('#temporizador')
, try to putdocument.getElementById('temporizador')
, without the old game– Francisco
What gives
console.log(typeof diego, diego);
?– Sergio