xxxxxxxxxx
1
<script
2
src="https://code.jquery.com/jquery-3.7.1.min.js"
3
integrity="sha256-/JqT3SQfawRcv/BIHPThkBvs0OEvtFFmqPF/lYI/Cxo="
4
crossorigin="anonymous"></script>
5
6
<select data-mdb-select-init multiple id="mySelect">
7
<option selected value="1">One</option>
8
<option selected value="2">Two</option>
9
<option selected value="3">Three</option>
10
<option value="4">Four</option>
11
<option value="5">Five</option>
12
<option value="6">Six</option>
13
<option value="7">Seven</option>
14
<option value="8">Eight</option>
15
</select>
16
<label class="form-label select-label">Example label</label>
17
18
<button id="getValue" class="btn btn-primary">
19
Get value
20
</button>
21
22
1
1
xxxxxxxxxx
1
$('#getValue').on('click', () => {
2
alert($('#mySelect').val())
3
})
4
Console errors: 0