I have a question regarding google maps and event handling/listening.
Using jQuery and google maps v3, I am able to place a map marker and an event listener that opens an infobubble when the user clicks on the marker. What I'd like to do (but so far haven't been able to figure out) is add another event handler to the contents of the info bubble. For example, if the user clicks on the map marker open the info bubble (that part works), and then if they click on something inside the infobubble do something else. I have pasted my code below, thanks in advance for any help
function addMarker(data) {
var myLatlng = new google.maps.LatLng(data.Latitude, data.Longitude);
var title = data.title? data.title: "";
var icon = $('#siteUrl').val() + 'img/locate.png';
var bubbleContentString = "<span class=\"bubble-details-button\">Get Details about " + title+ "</span>";
myInfoBubble = new InfoBubble({
content: bubbleContentString,
hideCloseButton: true,
backgroundColor: '#004475',
borderColor: '#004475'
});
var myMarker = new google.maps.Marker({
position: myLatlng,
map: map,
title: title,
icon: icon
});
addListenerToMarker(myMarker, myInfoBubble);
markerSet.push(myMarker, myInfoBubble);
}
function addListenerToMarker(marker, bubble){
console.log($(bubble.getContent()).find('.bubble-details-button')[0]);
google.maps.event.addListener(marker, 'click', function() {
if (!bubble.isOpen()) {
google.maps.event.addListenerOnce(bubble, 'domready', function(){
console.log($(bubble.getContent()).find('.bubble-details-button')[0]);
google.maps.event.addDomListener($(bubble.getContent()).find('.bubble-details-button')[0], 'click', function(){
alert("hi");
});
});
bubble.open(map, marker);
}
});
}