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

150
Views
Add custom ID to select2 container

I got the following code for my select2 dropdown menu. Is it possible to give a custom ID to the select2 select2-container? I need a custom a ID so i can add a certain class to it.

<th id="filter_16" class="cell ">
        <select id="input_16" class="select-filter select2-hidden-accessible" name="filter[aa_location_type_code]" data-select2-id="select2-data-input_16" tabindex="-1" aria-hidden="true"></select>
        <span class="select2 select2-container select2-container--default select2-container--focus" dir="ltr" data-select2-id="select2-data-11-gj73" style="width: 60px;"></span>
        <script>
            $(document).ready(function () {
                $("#input_16").select2();
                });
        </script>
</th>
about 4 years ago · Juan Pablo Isaza
2 answers
Answer question

0

If you need to add a certain class to the select2-container, you could use select2 containerCssClass

$select.select2({
  containerCssClass: 'myContainerCssClass'
});
about 4 years ago · Juan Pablo Isaza Report

0

$(document).ready(function () { let element = document.querySelector(".select2-container") element .id='newId' });

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!