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

161
Vistas
get event source that triggers events on other elements

In a ASPX MVC view, I use TypeScript to control the client interaction. Some elements' change event could trigger a sequence of other elements' change events. In each of the other element's change() I need to check if it is triggered by the element itself, or preceding element, or by the very first element that fires the event chain. In this example, it is Q12 or Q23, or both. Thanks.

const Q12: any = $('.persistable[id^=Q12_]');
const Q23: any = $('.persistable[id^=Q23_]');
const otherPersistables: any = $('.persistable:not([id^=Q12_]):not([id^=Q23_])');

if (commonUtility.isEmpty(Q12) || commonUtility.isEmpty(Q23)) {
  otherPersistables.each(
    function() {
      //disable this element and trigger it change() event
      $(this).prop('disabled', ture).change();
    }
  );
} else {
  otherPersistables.each(
    function() {
      //enable this element and trigger its change() event
      $(this).prop('disabled', false).change();
    }
  );
}

//add event listener to each of the other persistable elements
otherPersistables.each(
  const thisOtherElment = $(this); 
  thisOtherElment.on("change",
    function() {
     //how to check what really initiates this change if not by this element
     //for example, it could be Q23 or Q12, or both
    }
  }
);

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