mercredi 28 juin 2017

JavaScript: only display div if both conditions apply

I am trying to only display a div with ID of tiitutormsg if it is the case that an element with ID inboxTable AND there are more than two tabs on the screen.

Unfortunately the code below means that the div will also be displayed on pages without inbox table but where the number of tabs is more than two :(

I tried nested if statements to get around this, but no luck.

 if (!document.getElementById('inboxTable') && countItems('nav-tabs') <= 2) {
    /* do nothing */
  } else {
         document.getElementById("tiitutormsg").style.display = 'block';
         document.getElementById('overlay').style.display='block';
  }

Aucun commentaire:

Enregistrer un commentaire