jeudi 24 novembre 2016

If statement and innerHTML

Hello I have a gallery that shows a number so if the number is 2 the gallery will be on image 2.. What I want to do is check if the innerHTML is showing the text 2 and then have a div's innerHTML text change to something else and I want it to keep on checking infinitely. I have tried this but it is not working at all and nothing changes: js

var Count = getElementById("count").innerHTML;
function TE()
{
  if(Count === "2")
  {
     document.getElementById("credit").innerHTML = "Count number 2";
  }
};

html:

 <div id="credit">hello<span id="count">1</span><br></div>

Any ideas of what I'm doing wrong? thank you in advance

Aucun commentaire:

Enregistrer un commentaire