Select 2 drop-down input search doesn't work inside bootstrap pop-up modal


I am using the Bootstrap pop-up modal and select2 js dropdown inside it, Select 2 is working fine when used outside the pop-up modal, but when used inside pop-up modal, as shown in the bwlo image, dropdown is working, but search input is not working.

select-2-input-doesnot-work-inside-bootstrap-pop-up-modal.png

How to resolve this issue?


Asked by:- jaiprakash
0
: 12031 At:- 10/24/2018 8:52:53 AM
Bootstrap select2-dropdown-js javascript jquery







1 Answers
profileImage Answered by:- jaya

There can be two ways to make select2 search input work inside pop-up

  1. By removing the "tabindex" attribute from the modal. This will allow moving around in the Select2 box, but you lose the ability to close the modal using "Esc" button. (Tested and worked)
  2. use the below jQuery code 
    $("#select2Input").select2({ dropdownParent: "#modal-container" });?

Any of the above solutions will work, i have personally used 1st option, but second one should also be correct.

2
At:- 10/25/2018 2:44:23 PM
I tried the Solution 1 and worked for me, thanks 0
By : jaiprakash - at :- 11/20/2018 2:19:50 PM






Login/Register to answer
Or
Register directly by posting answer/details

Full Name *

Email *




By posting your answer you agree on privacy policy & terms of use