You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
<p>Chosen automatically sets the default field text ("Choose a country...") by reading the select element's data-placeholder value. If no data-placeholder value is present, it will default to "Select an Option" or "Select Some Options" depending on whether the select is single or multiple. You can change these elements in the plugin js file as you see fit.</p>
1233
1233
<pre><codeclass="language-markup"><select <strong>data-placeholder="Choose a country..."</strong> multiple class="chosen-select"></code></pre>
1234
-
<p><strong>Note:</strong> on single selects, the first element is assumed to be selected by the browser. To take advantage of the default text support, you will need to include a blank option as the first element of your select list.</p>
1234
+
<p><strong>Note:</strong> on single selects, the first element is assumed to be selected by the browser. To take advantage of the default text support, you will need to include a blank option as the first element of your select list - or include an element with the same label as the placeholder and set the <codeclass="language-javascript">hidden</code>, <codeclass="language-javascript">selected</code> and <codeclass="language-javascript">disabled</code> attributes on it for a more graceful degradation on devices Chosen does not support:</p>
1235
+
<pre><codeclass="language-markup"><option value="" selected disabled hidden>Choose a country...</option></code></pre>
1235
1236
</div>
1236
1237
1237
1238
<h2><aname="no-results-text-support" class="anchor" href="#no-results-text-support">No Results Text Support</a></h2>
<p>Chosen automatically sets the default field text ("Choose a country...") by reading the select element's data-placeholder value. If no data-placeholder value is present, it will default to "Select an Option" or "Select Some Options" depending on whether the select is single or multiple. You can change these elements in the plugin js file as you see fit.</p>
1234
1234
<pre><codeclass="language-markup"><select <strong>data-placeholder="Choose a country..."</strong> multiple class="chosen-select"></code></pre>
1235
-
<p><strong>Note:</strong> on single selects, the first element is assumed to be selected by the browser. To take advantage of the default text support, you will need to include a blank option as the first element of your select list.</p>
1235
+
<p><strong>Note:</strong> on single selects, the first element is assumed to be selected by the browser. To take advantage of the default text support, you will need to include a blank option as the first element of your select list - or include an element with the same label as the placeholder and set the <codeclass="language-javascript">hidden</code>, <codeclass="language-javascript">selected</code> and <codeclass="language-javascript">disabled</code> attributes on it for a more graceful degradation on devices Chosen does not support:</p>
1236
+
<pre><codeclass="language-markup"><option value="" selected disabled hidden>Choose a country...</option></code></pre>
1236
1237
</div>
1237
1238
1238
1239
<h2><aname="no-results-text-support" class="anchor" href="#no-results-text-support">No Results Text Support</a></h2>
0 commit comments