Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

188
Visualizações
Select2 Dropdown options disappear once I select any option
<select rows='3' name="user_id[]" required="required" multiple class="form-control select2" style="width: 100% !important">
    <?php
    $qid = $_GET['id'];
    $student = $conn->query('SELECT u.*,s.course as ls, s.branch, s.year FROM users u left join students s on u.id = s.user_id where u.user_type = 3 ');
    while ($row = $student->fetch_assoc()) {
        $user_id = $row['id'];
        $result = $conn->query('SELECT * FROM quiz_student_list where quiz_id ="'.$qid.'" and user_id = "'.$user_id.'"');
        if ($result->num_rows == 0) {
        ?>  
        <option value="<?php echo $row['id'] ?>"><?php echo ucwords($row['name']) . ' ' . $row['ls'] . ' ' . $row['branch'] . ' ' . $row['year'] ?></option>
    <?php } 
    }
    ?>
</select>



$(".select2").select2({
    placeholder: "Select here",
    width: 'resolve'
});

enter image description here

I have a students dropdown in select2 jquery but suppose I click on any one of the name it got selected but the options disappears. I have to click again to see the students list and click again on any other name. I want to select multiple in one go only.

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

$(".select2").select2({
    placeholder: "Select here",
    width: 'resolve',
    closeOnSelect: false
});

closeOnSelect: false by using this property I have actually got what I was looking for. I have set it to false so that it doesn't get closed on selection of any one of the options.

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda