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

126
Views
Manually triggered select event does not send event details

I am attemping to trigger the on select event handler by triggering the select event however when the event is triggered through code, the event details ((e.params)) is left undefined unlike when the select event is actually triggered by a manual selection

Is there any way to get the event details when trigger('select2:select') is used?

function filterRelevantClientsForSPAWithPreviousValues(){
    let tempSelectedClients = $('select[name=client_id]').val();
    console.log("Past selected client = "+tempSelectedClients);
    $('select[name=client_id]').empty();
    for(var i = 0; i < {{count($spa_client_list)}}; i ++){
      if({!! $spa_client_list !!}[i]['id'] == tempSelectedClients){
          var newOption = new Option({!!$spa_client_list!!}[i]['name'], {!!$spa_client_list  !!}[i]['id'], true, true);
          $('select[name=client_id]').append(newOption).trigger('change').trigger('select2:select');
      }
      else{
          var newOption = new Option({!!$spa_client_list!!}[i]['name'], {!!$spa_client_list  !!}[i]['id'], false, false);
          $('select[name=client_id]').append(newOption).trigger('change');
      }
    }
}

Event Handler

   $('select[name=client_id]').on('select2:select', function (e) {
        console.log("on select client 2 event has been triggered");
        console.log(e.params);
    })

Desired outcome enter image description here

Actual results

enter image description here

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!