Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

203
Vistas
JavaScript: Making a container closing X symbol output an action 'signal'

I have a container that is opened by a button (I have made it toggle so can close when re-clicking on the button using a bool variable (AreaContainerDialogOpen). The problem I have is the container has a window closing symbol: X top right which of course doesn't interact with the AreaContainerDialogOpen variable so clicking on the button doesn't always work as it has to turn off before it can turn back on so need to click twice if the X has been used to close. My question is: is there a way to get the X close action and set AreaContainerDialogOpen=false (preferred solution) ? Or can I remove the X closing symbol?

The container

   <div id="AreaContainer" class="container-fluid scrollBox fluidCentrePosition" style="display:none" title="Area">

The Button

 <button id="selectPRDAreas" class="btn btn-outline-dark" onclick="selectPRDAreas()">PRD Areas</button>


function selectPRDAreas()
{
            if (AreaContainerDialogOpen == false) {
                console.log("Opening AreaContainer");
                $("#AreaContainer").show(); 
                $("#AreaContainer").dialog();
                AreaContainerDialogOpen = true;
                //do stuff
    }
            else if (AreaContainerDialogOpen == true) {            
                $("#AreaContainer").dialog("close");
                AreaContainerDialogOpen = false;
            }
}

Thanks for your help, fairly new to javascript.

about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda