troubleshooting Question

Why is initMap returning "not a function" error.

Avatar of dlearman1
dlearman1Flag for United States of America asked on
3 Comments1 Solution3239 ViewsLast Modified:
I'm loading jQuery and Google Maps API using:
<script src=""></script>
            <script>window.jQuery || document.write('<script src="_js/vendor/jquery/2.1.4/jquery.min.js"><\/script>')</script>
            <script src=""></script>
            <script src=""></script>
            <script src=""></script>

InitMap looks like:

                      var map;
                      var thisLatLng;

                      function CenterControl(controlDiv, map){

                            // Set CSS for the control border.
                            var controlUI = document.createElement('div');
                   = '#fff';
                   = '2px solid #fff';
                   = 0;
                   = '0 2px 6px rgba(0,0,0,.3)';
                   = 'pointer';
                   = '12px';
                   = 'center';
                            controlUI.title = 'VIEW LARGER MAP';

                            // Set CSS for the control interior.
                            var controlText = document.createElement('div');
                   = 'rgba(0, 98, 101, 1)';     //'hsla(182, 100%, 20%, 1)';      //'rgb(25,25,25)';
                   = 'Helvetica,Arial,sans-serif';
                   = '14px';
                   = '24px';      //38px';
                   = '5px';
                   = '5px';
                            controlText.innerHTML = 'VIEW LARGER MAP';

                             // Setup the click event listeners
                            controlUI.addEventListener('click', function() {
                                        show: 'true'


                      function initMap() {
                            console.log("initMap says hello");
                            var thisLatLng = new google.maps.LatLng(47.727998, -122.241533);
                            var mapOptions = {
                                zoom: 13,
                                center: thisLatLng,
                                mapTypeId: google.maps.MapTypeId.ROADMAP,
                                disableDefaultUI: true          //remove this line or set to false if Google controls desired

                            map = new google.maps.Map(document.getElementById("google-map-panel-artessa"), mapOptions);

                            // Create the DIV to hold the control and call the CenterControl()
                            // constructor passing in this DIV.
                            var centerControlDiv = document.createElement('div');
                            var centerControl = new CenterControl(centerControlDiv, map);

                            centerControlDiv.index = 1;

                            var image = new google.maps.MarkerImage("_img/artessa/contact/map-marker/map-marker-artessa.png",
                                new google.maps.Size(136,90),
                                new google.maps.Point(0,0),
                                new google.maps.Point(0,90)

                            var shadow = new google.maps.MarkerImage("_img/artessa/contact/map-marker/shadow-marker-artessa.png",
                                new google.maps.Size(157, 46),
                                new google.maps.Point(0, 0),
                                new google.maps.Point(0, 41)

                            var marker = new google.maps.Marker({
                                position: thisLatLng,
                                map: map,
                                icon: image,
                                shadow: shadow

                               //   map.addOverlay(new google.maps.Marker(point, markerOptions));

                      }     // end initMap

I don't see the problem. Hopefully someone will.
Join our community to see this answer!
Unlock 1 Answer and 3 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 3 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros