Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>The current version of <a href="http://harvesthq.github.com/chosen/" rel="nofollow noreferrer">Chosen</a> provides two methods to control the display of the search box. Both are passed in as options during initialization. To hide the search box completely pass in the option <code>"disable_search": true</code>:</p> <pre><code>$("#mySelect").chosen({ "disable_search": true }); </code></pre> <p>Alternatively, if you want to show the search iff there are a certain number of options, use the option <code>"disable_search_threshold": numberOfOptions</code> (where <code>numberOfOptions</code> is the minimum number of options required before showing the search box):</p> <pre><code>$("#mySelect").chosen({ "disable_search_threshold": 4 }); </code></pre> <p><div class="snippet" data-lang="js" data-hide="true" data-console="false" data-babel="false"> <div class="snippet-code snippet-currently-hidden"> <pre class="snippet-code-js lang-js prettyprint-override"><code>jQuery(function($) { // Create a set of OPTION elements from some dummy data var words = ["lorem", "ipsum", "dolor", "sit", "amet,", "consectetur", "adipiscing", "elit", "duis", "ullamcorper", "diam", "sed", "lorem", "mattis", "tristique", "integer", "pharetra", "sed", "tortor"], options = $($.map(words, function(word) { return $(document.createElement('option')).text(word)[0]; })); $('select').each(function() { // Add the dummy OPTIONs to the SELECT var select = $(this).append(options.clone()); // Initialize Chosen, using the options from the // `data-chosen-options` attribute select.chosen(select.data('chosen-options')); }); });</code></pre> <pre class="snippet-code-css lang-css prettyprint-override"><code>body { font-family: sans-serif; font-size: .8em; } label { display: block; margin-bottom: 1.4em; } label .label { font-weight: bold; margin-bottom: .2em; } select { width: 14em; }</code></pre> <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"&gt;&lt;/script&gt; &lt;link href="https://cdnjs.cloudflare.com/ajax/libs/chosen/1.5.1/chosen.min.css" rel="stylesheet"/&gt; &lt;script src="https://cdnjs.cloudflare.com/ajax/libs/chosen/1.5.1/chosen.jquery.min.js"&gt;&lt;/script&gt; &lt;label&gt; &lt;div class='label'&gt;Default behavior&lt;/div&gt; &lt;select name='default' data-chosen-options='{}'&gt;&lt;/select&gt; &lt;/label&gt; &lt;label&gt; &lt;div class='label'&gt;No search at all&lt;/div&gt; &lt;select name='no-search' data-chosen-options='{ "disable_search": true }'&gt;&lt;/select&gt; &lt;/label&gt; &lt;label&gt; &lt;div class='label'&gt;Search iff more than 4 items&lt;/div&gt; &lt;select name='conditional-search' data-chosen-options='{ "disable_search_threshold": 4 }'&gt;&lt;/select&gt; &lt;/label&gt; &lt;label&gt; &lt;div class='label'&gt;Search iff more than 32 items&lt;/div&gt; &lt;select name='conditional-search' data-chosen-options='{ "disable_search_threshold": 32 }'&gt;&lt;/select&gt; &lt;/label&gt;</code></pre> </div> </div> </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.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      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