Skip to content

Commit 3bc7f4a

Browse files
committed
Added docs section for HTML labels
This will make it easier in the future to test that we support labels, and it tells people who are looking to confirm that we support labels that we in fact do.
1 parent 31e7a1d commit 3bc7f4a

1 file changed

Lines changed: 35 additions & 2 deletions

File tree

docs/_includes/examples/basics.html

Lines changed: 35 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,39 @@ <h2 id="multiple">Multiple select boxes</h2>
5959
<option value="WY">Wyoming</option>
6060
</select>
6161
{% endhighlight %}
62-
</section>
6362

64-
</section>
63+
<h2>Select boxes with labels</h2>
64+
65+
<p>
66+
You can, and should, use a <code>&lt;label&gt;</code> with Select2, just like any other <code>&lt;select&gt</code> element.
67+
</p>
68+
69+
<div class="s2-example">
70+
<p>
71+
<label for="id_label_single">
72+
Click this to highlight the single select element
73+
<select class="js-example-basic-single js-states form-control" id="id_label_single"></select>
74+
</label>
75+
</p>
76+
<p>
77+
<label for="id_label_multiple">
78+
Click this to highlight the multiple select element
79+
<select class="js-example-basic-multiple js-states form-control" id="id_label_multiple" multiple="multiple"></select>
80+
</label>
81+
</p>
82+
</div>
83+
84+
{% highlight html linenos %}
85+
<label for="id_label_single">
86+
Click this to highlight the single select element
87+
88+
<select class="js-example-basic-single js-states form-control" id="id_label_single"></select>
89+
</label>
90+
91+
<label for="id_label_multiple">
92+
Click this to highlight the multiple select element
93+
94+
<select class="js-example-basic-multiple js-states form-control" id="id_label_multiple" multiple="multiple"></select>
95+
</label>
96+
{% endhighlight %}
97+
</section>

0 commit comments

Comments
 (0)