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

106
Vistas
is there any way to make on change event work when we click on some thing else using jquery

after so many research i have achieved this we have 3 images and 3 options when i select 1st image first option from select is being selected , The remaining thing is onchange event on select is not working how can i achieve that ? this is the code i have tried this to trigger on change event but no luck

    $('.product-medias .swiper-slide').each(function(item, index){
    
    $(this).click(function(){
        console.log('clicked')
        
        var secondIndexSelect = $(this).attr('data-media-index');
        var parsedIndex = parseInt(secondIndexSelect, 10)
        $("select#SingleOptionSelector-0 option").eq(`${parsedIndex}`).prop('selected', true).trigger('change'); // trigger "change" and "focus" i have tried both
        $('.product-single__media-s .product-single__media').removeClass('product-single__media--selected');
        $(`.product-single__media-s .product-single__media:nth-child(${parsedIndex + 1})`).addClass('product-single__media--selected');
    })
})

right now in my code when i select index 1 image the first option is selected but on change event is not working . is there any way to bind it ?

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