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

123
Visualizações
Why only single change event is working on select element in jQuery?

I need to change behavior of jQuery library (date range picker), it have code like this:

box.find('.month').off("change").change(function(evt) {
    dateChanged($(this));
});
box.find('.year').off("change").change(function(evt) {
    dateChanged($(this));
});

Those are two select elements. It don't return false and functions inside handler don't access the event. But for some reason my events that use delegation doesn't work. They are ignored.

$picker.on('change', 'select', function() {
   console.log('CHANGE');
});

The console log is not executing, but if I remove previous lines from the library, my event delegation code works fine.

NOTE: $picker is object in my code that is parent of box element. But I also have event added on $(document) that is also not working.

First time I see something like this. Adding event directly to element, prevents event propagation. Can someone explain what is happening here? Is this documented anywhere?

This happens in Firefox and Chrome.

If someone need simple example, I can create one. But thought that this is self explanatory.

EDIT: I've created a simple reproduction and it works fine. I have complex application with a lot of files (R Shiny Application), but I don't see any change events in dev tools. Are there any way of making the event not propagate? Maybe using event capturing. What should I search for in order to find the code that is preventing the events from propagating?

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