Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

207
Visualizações
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 à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda