-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathform2.js
More file actions
34 lines (29 loc) · 1.11 KB
/
form2.js
File metadata and controls
34 lines (29 loc) · 1.11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
let map;
let marker;
function initMap() {
map = new google.maps.Map(document.getElementById("map"), {
center: { lat: 37.7749, lng: -122.4194 },
zoom: 13,
});
marker = new google.maps.Marker({
position: { lat: 37.7749, lng: -122.4194 },
map: map,
draggable: true,
});
google.maps.event.addListener(marker, "dragend", function (event) {
document.getElementById("location").value = event.latLng.lat() + ", " + event.latLng.lng();
});
}
document.getElementById("form").addEventListener("submit", function (event) {
event.preventDefault();
const name = document.getElementById("name").value;
const location = document.getElementById("location").value;
const mobile = document.getElementById("mobile").value;
const vehicle = document.getElementById("vehicle").value;
const description = document.getElementById("description").value;
console.log("Name: " + name);
console.log("Location: " + location);
console.log("Mobile: " + mobile);
console.log("Vehicle: " + vehicle);
console.log("Description: " + description);
});