question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Can't type in Select2 dropdown input search field

See original GitHub issue

Can’t type in Select2 dropdown input search field.

I have found many issues listed which mentions the same problem but nothing worked for me (https://www.google.com/search?q=can’t+type+in+select2&ie=utf-8&oe=utf-8&client=firefox-b-ab). I can’t type in Select2 dropdown input search field in model dialog using jQuery. By the way i can select value fine from dropdown. Tried inserting tabindex: 0 but no luck.

    $.ajax({
        type: "POST",
        url: "<?php echo $myScripts; ?>",
        data: { id1: "get-release-dropdown-html", id100: "<?php echo $dbTable; ?>" },
        success:function(releaseDropdown){

          $('#progress').hide();

          $( "#modelDialog1" ).dialog({
            modal: true,
            width: '570',
            height: '600',
            resizable: true,
            position:
            {
                my: "center",
                at: "center",
                of: window,
             },
            title: "Trigger Build",
            open: function() {

                $(this).html("<br/>Please select job options.<br/><br/><br/><b>Release:</b>" + releaseDropdown + "<div style='margin-top:30px;'/><b>Build Release Candidate:</b><select id='sReleaseCandidate'><option value='ga' selected>GA</option><option value='beta1'>BETAX</option>'></br>");

                $("#sDescription").focus();

                $("#sRelease, #sReleaseCandidate").select2({
                    tags: true
                });
            },

            close: function() {
                $( this ).dialog( "close" );

            },

        });

    }

});

https://stackoverflow.com/questions/46545729/cant-type-in-select2-dropdown-input-search-field-http-kevin-brown-com-select

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:1
  • Comments:18 (3 by maintainers)

github_iconTop GitHub Comments

45reactions
ProgrammingTestGitHubcommented, Oct 3, 2017

Is the problem releated to #4871?

You could try to define the parameter “DropdownParent” of the select2 element. The name given to the parameter is the name of the modal form where the select2 is placed on. Here below an example of how to use this parameter.

$(document).ready(function() {
      $("#select2insidemodal").select2({
              dropdownParent: $("#myModal")
      });
});

24reactions
zainqayyum954commented, Jun 7, 2018

remove “tabindex” attribute from modal

Read more comments on GitHub >

github_iconTop Results From Across the Web

Code - Stack Overflow
I can't type in Select2 dropdown input search field in model dialog using jQuery. By the way i can select value fine from...
Read more >
Common problems - The jQuery replacement for select boxes
Select2 does not function properly when I use it inside a Bootstrap modal. This issue occurs because Bootstrap modals tend to steal focus...
Read more >
Sign in - YouTube
jQuery : Can't type in Select2 dropdown input search field (http://kevin-brown.com/select2/). 38 views ...
Read more >
How to get Select2 searchable dropdown to work inside a modal
I need a searchable dropdown inside my modal. ... </select>. This adds a second search box underneath, but you can't type in it....
Read more >
Select 2 drop-down input search doesn't work inside bootstrap ...
By removing the " tabindex " attribute from the modal. This will allow moving around in the Select2 box, but you lose the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found