I dont understand why my onsubmit handler isn't being fired on submit. It is defined in a js file and required by the html file. like so:
GMaps.js
window.onload = function(){
(function initMap() {
var myLatLng = {lat: -25.363, lng: 131.044};
var map = new google.maps.Map(document.getElementById('map'), {
zoom: 4,
center: myLatLng
});
var marker = new google.maps.Marker({
position: myLatLng,
map: map,
title: 'Hello World!'
});
})();
function gsubmit(event){
event.preventDefault();
console.log("hi");
}
};
and GMaps.ejs
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no">
<meta charset="utf-8">
<title>Google Maps Example</title>
<script src="/javascripts/GMaps.js"> </script>
<script src="https://maps.googleapis.com/maps/api/js?key=+MYKEY+&signed_in=true"></script>
<link rel="stylesheet" type="text/css" href="/stylesheets/GMaps.css">
</head>
<body>
<div id="map"></div>
</br>
<form onsubmit="gsubmit()">
Search: <input id="gplace" type="text" placeholder ="input a place to locate">
<input type="submit"></input>
</form>
</body>
</html>
This is just a basic example of using a gmap and I can't get the form to recognize my submit handler