Reputation: 211
I have a working google map using the JavaScript API v3, but I am getting a javascript error on a new function I added.
I'm working on a new function to make links outside the map that show the respective infowindow on its marker. It should work like this.
I have the new features commented in my code on this jsfiddle as // TESTING
In the console, clicking the links outside of the map throws the error:
Uncaught ReferenceError: htmlinfowindowclick is not defined
Here's my code:
Thanks!
Upvotes: 2
Views: 1990
Reputation: 22497
The htmlinfowindowclick
function should be outside of the initialize
function. Also var gmarkers = [];
should be defined outside your functions so that it can be accessed by both functions.
var gmarkers = [];
function htmlinfowindowclick(item) {
google.maps.event.trigger(gmarkers[item], 'click');
}
function initialize() {
[...]
}
Upvotes: 2