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

103
Visualizações
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 à 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