Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

184
Vistas
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
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda