What’s wrong with this code?

Asked

Viewed 33 times

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?

  • 2

    I am very lay in javascript, but try to do the following: Instead of putting document.getElementById('#temporizador'), try to put document.getElementById('temporizador'), without the old game

  • What gives console.log(typeof diego, diego);?

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.