How to deal with annoying JS message?

0

On my page I have several manners that are shown after being redirected after certain conditions have been met. The problem is that when I click on any element of the page that I did not send to another page, console sends me this message: Uncaught ReferenceError: session is not defined     at clickfueraSession This does not negatively affect the operation of the page since everything works as it should, but it is very annoying to see how this message keeps appearing in console, so I would like to ask your help to deal with this little problem, I leave the code:

PHP

 <?php 
      if (isset($_GET['alert']) && $_GET['alert']=="iniciar_Session") {
    ?>
    <div class="sessionModal" id="session">
      <div class="contenidoModal" id="contenidoCaducado">
        <div class="modalHeader">
          <h2>¡Debes registrate o iniciar Session!</h2>
        </div>
        <div class="modalBody">
          <p>Debes estar registrado o iniciar session para poder comprar.</p>
        </div>
        <div class="modalFooter">
          <h2>diseñosweb</h2>
        </div>
      </div>
    </div>
    <?php
      }
    ?>

JS

var modalSession = document.getElementById('session');

window.addEventListener('click', clickfueraSession);

 function clickfueraSession(e){
   if (e.target == session) {
   session.style.display = 'none';
   }
  }
    
asked by jmz 13.09.2018 в 01:18
source

0 answers