I’m a beginner on Gmaps programming.
I want to create an InfoWindow containing two tabs, one of them just with infomation and the other one with some HTML-form (button and text).
http://gmaps-samples-v3.googlecode.com/svn/trunk/infowindow/tabs.html
var checkText = "Coordinates";
var content = [
'<div id="tabs">',
'<ul>',
'<li><a href="#tab_1"><span>One</span></a></li>',
'<li><a href="#tab_2"><span>Two</span></a></li>',
'</ul>',
'<div id="tab_1">',
'<p>Marker i:"</p>'+
'<form id='button'>'+
'<div>'+
'<input type='submit' value='Submit' />'+
'</div>'+
'</form>',
'</div>',
'<div id="tab_2">',
'<p>Info: '+checkText+'</p>',
'</div>',
'</div>'
].join('');
And then, the event listener:
google.maps.event.addListener(infoWindow, 'domready', function() {
$("#tabs").tabs();
});
google.maps.event.addListener(marker, 'click', function(event) {
infoWindow.setContent(content);
infoWindow.open(map, marker);
});
The tabs are perfectly showed and also the button, but I don’t know how to associate it to an action, for example:
marker.draggrable = true; // letting the marker to move
checkText = marker.getPosition(); // changing the tab info whenever marker moves
I guess this issue is not related with jquery-tabs but with any infowindow with an html-form inside.
Thanks.
//————————-
I will simplify my question.
I have prepared this example where you can find a “button” in the infowindow:
http://www.sipa.es/prueba_fer/index_prueba.html
How can I associate an action to that button?
For example, changing the zoom, open a new window, etc.
Thanks
The marker object has drag events:
Then update your content when the event fires
UPDATE:
Ok, you need to make sure you catch the elements in the infowindow when they are attached to the DOM. Infowindows have a
domreadyevent. I updated the function in your example to show this. Also, remember a postback will reset the map. You did not say whether you need a post back or not, so I cancelled it usinge.preventDefault();