Search code examples
jqueryhtmljquery-select2-4

small width of <select> tag but large window for select2


I am looking for a way to code my selects which have a small width so that once they are clicked the window that opens will have a certain dimension that is definitely larger than the one I have already. For instance if I have

<select id = "tester" style = "width:20px">

then with the familiar $("#tester").select2();

(which is relatively small), when the user clicks on the select (which in my case has options that are about 6-8 words long) the window that shows is much too small to read anything. Any tips appreciated.


Solution

  • Try to wrapp your <select> tag

    like this:

    <div style="width: 20px">
       <select id="tester">
    </div>
    

    It should work fine. Also you can add max-width: 20px to the div