Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

104
Views
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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!