I have a google map on my website. Each infowindow opens when the respective marker is clicked and contains a checkbox with an individual id. When the checkbox is checked, a console-message is fired. Here is the code:
function initialize()
{
var mapOptions =
{
center: new google.maps.LatLng(-34.600, -58.400),
zoom: 12,
mapTypeId: google.maps.MapTypeId.ROADMAP,
minZoom: 12,
scrollwheel: false,
};
var map = new google.maps.Map(document.getElementById("map_canvas"), mapOptions);
var point1 = new google.maps.LatLng(-34.600, -58.400)
dot0001 = new google.maps.Marker(
{
position: point1,
map: map,
})
var point2 = new google.maps.LatLng(-34.620, -58.400)
dot0002 = new google.maps.Marker(
{
position: point2,
map: map,
})
var infowindow = new google.maps.InfoWindow({});
function filltheinfowindow(markername, numbercode, object)
{
infowindow.open (map, markername)
infowindow.setContent(
'<div id="tabsinfo'+numbercode+'" class="infotabs">'+
'<ul><li><a href="#tabsinfo0001-1">Details</a></li>'+
'<li><a href="#tabsinfo0001-2">Photos</a></li></ul>'+
'<div id="tabsinfo0001-1">'+
'<input name="" type="checkbox" id="checkboxinfo'+numbercode+'" value="">'+
'</div>'+
'<div id="tabsinfo0001-2">'+
'<img src="_objects/_object0001/_images/1.jpg">'+
'</div>'+
'</div>')
}
function activatecheckbox(numbercode)
{
$("#tabsinfo"+numbercode).tabs();
$('#checkboxinfo'+numbercode).change(function()
{
if($('#checkboxinfo'+numbercode).is(':checked'))
{
console.log("checkboxtest")
}
})
}
google.maps.event.addListener(dot0001, 'click', function()
{
filltheinfowindow(dot0001, "0001")
})
google.maps.event.addListener(dot0002, 'click', function()
{
filltheinfowindow(dot0002, "0002")
})
google.maps.event.addListener(infowindow, 'domready', function()
{
activatecheckbox("0001")
})
google.maps.event.addListener(infowindow, 'domready', function()
{
activatecheckbox("0002")
})
}
Here is the problem: the console message is fired twice when the checkbox is checked.
Here is the strange thing: When I load the webpage without the image in tab two, the console message is fired only once, like it is supposed to. Unfortunately the images are an essential part of my website.
For me this makes absolutely no sense.
Any help appreciated