mardi 25 juin 2019

How can I repeat if else innerHTML

How can I repeat this after click.

var maxResults = 0;
maxResults += 1;

if (maxResults < 7) {

  localStorage.setItem("example", id.innerHTML = "1" + id.innerHTML);

} else if (maxResults > 1 && maxResults < 8) {

  localStorage.setItem("example", id.innerHTML = "0");

}

Illustration the results as below:

111111
0
111111
0
111111
0

Thanks!

Aucun commentaire:

Enregistrer un commentaire