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

228
Views
How To Avoid Select2 Triggering Change, but fix the option to particular value from the database?

I have a problem with select2 jquery. I want to fix the option to a particular option when it populates data from the database. But I don't want to use the change because there are other events tied to it. Is there any possibility to fix an option in select2 without triggering the change?

The current code is like this. But I don't want to trigger the change.

$('.roles').val(v).attr("old", v).attr('rowid', dc.id).trigger("change.select2");
     
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

I solved the issue. I had to reinitialize the select box after setting the value like the following

$('.roles').val(3);

$(".roles").select2({
      minimumResultsForSearch: -1,
      
    })
about 4 years ago · Juan Pablo Isaza Report
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!