I am attempting to retrieve values from forms using the submit event. However, I am encountering difficulty resetting those forms later on. I am using an id called "myForm" and an onclick function to try and achieve this.
<form (Submit)="addMarker()" id="myForm">
<div class="row">
<div class="col">
<input type="text" [(ngModel)]="lat" name="lat" class="form-control" placeholder="Latitude">
</div>
<div class="col">
<input type="text" [(ngModel)]="lng" name="lng" class="form-control" placeholder="Longitude">
</div>
<div class="col-3">
<button type="submit" class="btn btn-primary" onclick="myFunction()">Add Marker</button>
</div>
</div>
</form>
Script:
function myFunction() {
document.getElementById("myForm").reset();
}