xxxxxxxxxx
1
<div class="card p-4 mt-3 my-2">
2
<div class="card-body">
3
<h5 class="card-title mb-3">FORM RESET</h5>
4
<form id="user-info" enctype="multipart/form-data" method="post" action="/Dev/Test">
5
<div class="form-row">
6
<div class="form-group col-6">
7
<label for="first-name">First Name</label>
8
<input type="text" id="first-name" class="form-control form-control-sm">
9
</div>
10
<div class="form-group col-6">
11
<label for="last-name">Last Name</label>
12
<input type="text" id="last-name" class="form-control form-control-sm">
13
</div>
14
<div class="col-4">
15
<label class="mb-0">Gender</label>
16
<select class="mdb-select">
17
<option value="M">Male</option>
18
<option value="F">Female</option>
19
</select>
20
</div>
21
</div>
22
<div class="d-flex justify-content-center">
23
<button type="reset" class="btn btn-sm btn-danger waves-effect waves-light">Reset</button>
24
<button id="reset-btn" type="reset" class="btn btn-sm btn-warning waves-effect waves-light">Reset from js</button>
25
</div>
26
<small class="text-muted">After pressing reset the wrapper of the 'Gender' select will by multiplied</small>
27
</form>
28
</div>
29
</div>
1
1
xxxxxxxxxx
1
$(document).ready(function(){
2
$(".mdb-select").materialSelect();
3
});
4
$("#reset-btn").click(function(){
5
$("#user-info")[0].reset();
6
});
Console errors: 0