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

97
Visualizações
select2 duplicated in iziModal

I use iziModal for my modal, but select2 select box is not clickable in modal,

i added the following code after initializing modal:

$('#mySelect2').select2({
            dropdownParent: $('#myIziModal')
        });

but now select box is duplicated and one of the select boxes is working fine but the other is not clickable

modal code:

<div id="myIziModal" style="display: none;">
    <select class="select mySelect2" style="width: 150px;">
        <option value="1">one</option>
        <option value="2">two</option>
        <option value="3">three</option>
    </select>
</div>
function showModal() {
        $("#myIziModal").iziModal({
            title: "info",
        });
        $("#myIziModal").iziModal('open');

        $('.mySelect2').select2({
            dropdownParent: $('#myIziModal')
        });
    }

note: when i use $('.Select2').select2({ dropdownParent: $('#myIziModal') }); select box is not duplicated and is clickable but do not display any options.

output

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

0

Because You are using ID(id="mySelect2), Please Use class for define select 2

Like this $('.mySelect2').select2({ dropdownParent: $('#myIziModal') });

and use in class property any where in the code Like this <div id="myIziModal" style="display: none;"> <select class="select mySelect2" style="width: 150px;"> <option value="1">one</option> <option value="3">two</option> <option value="5">three</option> </select> </div>

about 4 years ago · Juan Pablo Isaza Relatório

0

The select element must have a class with name select2. so if you use another class name for the select element you have to changed it(only the select element that is in the modal).

<div id="myIziModal">
    <select id="mySelect2" class="select2">
        <option value="1">one</option>
        <option value="2">two</option>
        <option value="3">three</option>
    </select>
</div>
function showModal() {
        $("#myIziModal").iziModal();
        $("#myIziModal").iziModal('open');

        $('#mySelect2').select2({
            dropdownParent: $('#myIziModal')
        });
    }
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