Skip to content

Commit f0098aa

Browse files
committed
docs: ✏️ tweak demo
1 parent 896f395 commit f0098aa

2 files changed

Lines changed: 10 additions & 10 deletions

File tree

docs/index.html

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ <h3>Example of <a href="https://github.com/ttskch/select2-bootstrap4-theme" targ
2424
<form>
2525
<div class="form-group">
2626
<label>Example of select</label>
27-
<select placeholder="Choose one thing" data-allow-clear="1">
27+
<select data-placeholder="Choose one thing" data-allow-clear="1">
2828
<option></option>
2929
<option>1</option>
3030
<option>2</option>
@@ -35,7 +35,7 @@ <h3>Example of <a href="https://github.com/ttskch/select2-bootstrap4-theme" targ
3535
</div>
3636
<div class="form-group">
3737
<label>Example of multiple select</label>
38-
<select multiple placeholder="Choose anything" data-allow-clear="1">
38+
<select multiple data-placeholder="Choose anything" data-allow-clear="1">
3939
<option>1</option>
4040
<option>2</option>
4141
<option>3</option>
@@ -45,12 +45,12 @@ <h3>Example of <a href="https://github.com/ttskch/select2-bootstrap4-theme" targ
4545
</div>
4646
<div class="form-group">
4747
<label>Example of disabled select</label>
48-
<select disabled placeholder="Cannot choose">
48+
<select disabled data-placeholder="Cannot choose">
4949
</select>
5050
</div>
5151
<div class="form-group">
5252
<label>Example of select with optgroup</label>
53-
<select placeholder="Choose one thing">
53+
<select data-placeholder="Choose one thing">
5454
<option></option>
5555
<optgroup label="Group A">
5656
<option>A1</option>
@@ -70,15 +70,15 @@ <h3>Example of <a href="https://github.com/ttskch/select2-bootstrap4-theme" targ
7070
<div class="input-group-prepend">
7171
<span class="input-group-text">Prepend</span>
7272
</div>
73-
<select placeholder="Choose on thing">
73+
<select data-placeholder="Choose on thing">
7474
<option></option>
7575
<option>1</option>
7676
<option>2</option>
7777
<option>3</option>
7878
</select>
7979
</div>
8080
<div class="input-group mt-2">
81-
<select placeholder="Choose on thing">
81+
<select data-placeholder="Choose on thing">
8282
<option></option>
8383
<option>1</option>
8484
<option>2</option>
@@ -92,7 +92,7 @@ <h3>Example of <a href="https://github.com/ttskch/select2-bootstrap4-theme" targ
9292
<div class="input-group-prepend">
9393
<span class="input-group-text">Prepend</span>
9494
</div>
95-
<select placeholder="Choose on thing">
95+
<select data-placeholder="Choose on thing">
9696
<option></option>
9797
<option>1</option>
9898
<option>2</option>
@@ -105,7 +105,7 @@ <h3>Example of <a href="https://github.com/ttskch/select2-bootstrap4-theme" targ
105105
</div>
106106
<div class="form-group">
107107
<label>Example of validated select</label>
108-
<select placeholder="Invalid example" class="form-control is-invalid">
108+
<select data-placeholder="Invalid example" class="form-control is-invalid">
109109
<option></option>
110110
</select>
111111
<div class="invalid-feedback">

docs/script.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ $(function () {
22
$('select').each(function () {
33
$(this).select2({
44
theme: 'bootstrap4',
5-
width: 'style',
6-
placeholder: $(this).attr('placeholder'),
5+
width: $(this).data('width') ? $(this).data('width') : $(this).hasClass('w-100') ? '100%' : 'style',
6+
placeholder: $(this).data('placeholder'),
77
allowClear: Boolean($(this).data('allow-clear')),
88
});
99
});

0 commit comments

Comments
 (0)