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

179
Views
Adding bootstrap 'selectpicker' class makes control dissapear

I need to change according to each user a select with companies. I make an ajax call to retrieve the complete select element, if the element contents the "selectpicker" class it gives no error but remains hidden (I guess, just realizing of that class thing took two hours). Retrieving it without any class shows the element, and if I add it later with classListAdd is hidden again. If I load a select with that class from the begining it appears ok. Code below. I put the text of the select retrieved in 'response' for this question.

if(ajaxRequest.readyState == 4){
    var response = ajaxRequest.responseText;
    console.log(response);
    document.getElementById('companies').innerHTML = '<select id="select-multiple"  data-size="10" data-width="100%" multiple data-live-search="true" title="Seleccione Empresa" multiple data-selected-text-format="count"><option value="58">-</option><option value="28"> C.A.P.S.A. Capex</option></select>';
    document.getElementById('select-multiple').classList.add('selectpicker'); //without this line element shows, with it nothing shows
    var testArray = document.getElementById('empresas').value.split(',');
    $('#select-multiple').val(testArray); //no javascript error (element should exists)
    $('#select-multiple').trigger("change");

    }
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!