|
@@ -3,6 +3,24 @@
|
|
How should Select2 be initialized?
|
|
How should Select2 be initialized?
|
|
</h2>
|
|
</h2>
|
|
|
|
|
|
|
|
+ <p>
|
|
|
|
+ Select2 will register itself as a jQuery function if you use any of the distribution builds, so you can call <code>.select2()</code> on any jQuery element where you would like to initialize Select2.
|
|
|
|
+ </p>
|
|
|
|
+
|
|
|
|
+<pre class="prettyprint">
|
|
|
|
+$('select').select2();
|
|
|
|
+</pre>
|
|
|
|
+
|
|
|
|
+ <p>
|
|
|
|
+ You can optionally pass an object containing all of the options that you would like to initialize Select2 with.
|
|
|
|
+ </p>
|
|
|
|
+
|
|
|
|
+<pre class="prettyprint">
|
|
|
|
+$('select').select2({
|
|
|
|
+ placeholder: 'Select an option'
|
|
|
|
+});
|
|
|
|
+</pre>
|
|
|
|
+
|
|
<h3 id="setting-default-options">
|
|
<h3 id="setting-default-options">
|
|
Can default options be set for all dropdowns?
|
|
Can default options be set for all dropdowns?
|
|
</h3>
|
|
</h3>
|
|
@@ -44,12 +62,16 @@ $.fn.select2.defaults.set("theme", "classic");
|
|
string.
|
|
string.
|
|
</p>
|
|
</p>
|
|
|
|
|
|
|
|
+<pre class="prettyprint">
|
|
|
|
+$.fn.select2.defaults.set("ajax--cache", false);
|
|
|
|
+</pre>
|
|
|
|
+
|
|
<h3>
|
|
<h3>
|
|
How can I reset all of the global default options?
|
|
How can I reset all of the global default options?
|
|
</h3>
|
|
</h3>
|
|
|
|
|
|
<p>
|
|
<p>
|
|
- You can reset the default options by calling
|
|
|
|
|
|
+ You can reset the default options to their initial values by calling
|
|
</p>
|
|
</p>
|
|
|
|
|
|
<pre class="prettyprint">
|
|
<pre class="prettyprint">
|