Google Maps Uncaught TypeError: Cannot read property 'LatLng' of undefined
api, google-maps, javascript
Solution
Looks like the problem is this is missing the closing tag for `<script>` for the include of jquery.js:
<script
type="text/javascript"
src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.js"/>
<script
type="text/javascript"
src="https://maps.googleapis.com/maps/api/js?v=3&sensor=true">
</script>
`<script>` tags need to be closed with `</script>`, it should be:
<script
type="text/javascript"
src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.js">
</script>
<script
type="text/javascript"
src="https://maps.googleapis.com/maps/api/js?v=3&sensor=true">
</script>
For more information see: Why don't self-closing script tags work?
Problem
I keep getting this error "Uncaught TypeError: Cannot read property 'LatLng' of undefined" when trying to create a map In the Head: ``` <script type="text/javascript" src="https://www.google.com/jsapi"></script> <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.js"/> <script type="text/javascript" src="https://maps.googleapis.com/maps/api/js?v=3&sensor=true"></script> ``` ............. ``` function init(){ var latlng = new google.maps.LatLng(-43.552965, 172.47315); var myOptions = { zoom: 10, center: latlng, mapTypeId: google.maps.MapTypeId.ROADMAP }; map = new google.maps.Map(document.getElementById("map"), myOptions); } ``` ............. ``` <body> <div id="map" style="width:600px;height: 600px;"> </div> <ul class="navigation"> </ul> </body> ```