xxxxxxxxxx
1
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.7.1/jquery.min.js"></script>
2
3
<!-- Button trigger modal -->
4
<button type="button" class="btn btn-primary" data-mdb-ripple-init data-mdb-modal-init data-mdb-target="#exampleModal">
5
Launch demo modal
6
</button>
7
8
<!-- Modal -->
9
<div class="modal fade" id="exampleModal" tabindex="-1" aria-labelledby="exampleModalLabel" aria-hidden="true">
10
<div class="modal-dialog">
11
<div class="modal-content">
12
<div class="modal-header">
13
<h5 class="modal-title" id="exampleModalLabel">Modal title</h5>
14
<button type="button" class="btn-close" data-mdb-ripple-init data-mdb-dismiss="modal" aria-label="Close"></button>
15
</div>
16
<div class="modal-body">
17
<div id="datepicker" class="form-outline" data-mdb-datepicker-init data-mdb-input-init>
18
<input type="text" class="form-control" id="exampleDatepicker11" />
19
<label for="exampleDatepicker11" class="form-label">Select a date</label>
20
</div>
21
</div>
22
23
</div>
24
</div>
25
</div>
1
1
xxxxxxxxxx
1
let options = {
2
format:'mm/dd/yyyy',
3
disableFuture: false,
4
min: new Date("01/01/1900"),
5
max: new Date(),
6
inline: true,
7
container: '#exampleModal'
8
}
9
10
const elementId = 'datepicker'
11
mdb.Datepicker.getOrCreateInstance($('#'+elementId)).update(options);
Console errors: 0