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

259
Visualizações
jQuery fire an event and receive it

I want to fire event globally and receive it anywhere in my application. Based on the event received, I want to perform some operations.

I have a multistep form when user click the next button, I want to trigger an event

function multiStep(){
    $('.body').trigger('stepchanged');

}

Now I want to receive stepchanged in another function and perform some operations.

if (stepchanged){
//do something
} 

How to receive the events? Thanks

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

You need an event handler that sets the variable.

`$(".body").on("stepchanged", function() { 
    stepchanged = true;
})`

Although there's not really any need for the event handler, unless it does other things. You can just set the global variable in multistep().

about 4 years ago · Juan Pablo Isaza Relatório
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