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

98
Views
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 answers
Answer question

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 Report

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