Note that there are some explanatory texts on larger screens.

plurals
  1. POSelect2 doesn't work when embedded in a bootstrap modal
    primarykey
    data
    text
    <p>When I use a select2 (input) in bootstrap modal, I can't type anything into it. It's like disabled? Outside he modal select2 works fine.</p> <p><img src="https://i.stack.imgur.com/h0I0M.jpg" alt="enter image description here"></p> <p>working example: <a href="http://jsfiddle.net/byJy8/1/" rel="noreferrer">http://jsfiddle.net/byJy8/1/</a> code:</p> <pre><code>&lt;!-- Modal --&gt; &lt;div id="myModal" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true"&gt; &lt;div class="modal-header"&gt; &lt;button type="button" class="close" data-dismiss="modal" aria-hidden="true"&gt;×&lt;/button&gt; &lt;h3 id="myModalLabel"&gt;Panel&lt;/h3&gt; &lt;/div&gt; &lt;div class="modal-body" style="max-height: 800px"&gt; &lt;form class="form-horizontal"&gt; &lt;!-- Text input--&gt; &lt;div class="control-group"&gt; &lt;label class="control-label" for="vdn_number"&gt;Numer&lt;/label&gt; &lt;div class="controls"&gt; &lt;!-- seleect2 --&gt; &lt;input name="vdn_number" type="hidden" id="vdn_number" class="input-large" required="" /&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt; &lt;div class="modal-footer"&gt; &lt;button class="btn" data-dismiss="modal" aria-hidden="true"&gt;Close&lt;/button&gt; &lt;button class="btn btn-primary"&gt;Save changes&lt;/button&gt; &lt;/div&gt; &lt;/div&gt; </code></pre> <p>adn js</p> <pre><code>$("#vdn_number").select2({ placeholder: "00000", minimumInputLength: 2, ajax: { url: "getAjaxData/", dataType: 'json', type: "POST", data: function (term, page) { return { q: term, // search term col: 'vdn' }; }, results: function (data) { // parse the results into the format expected by Select2. // since we are using custom formatting functions we do not need to alter remote JSON data return {results: data}; } } }); </code></pre> <p>answers:</p> <p>here you can find a quick <a href="https://stackoverflow.com/a/18487440/1251563">fix</a></p> <p>and here is 'the right way': <a href="https://stackoverflow.com/questions/18487056/select2-doesnt-work-when-embedded-in-a-bootstrap-modal/19574076#19574076">Select2 doesn&#39;t work when embedded in a bootstrap modal</a></p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload