(I\'m learning on my own, I know my code is messy, inb4 sorry) I have a table with some data and a button, I want that when I press the button a marker appears on the map in the
Is this what you're looking for?
The addmarker
function, being called by the button agregar
, was inside the myMap
function. I have separated them.
I have also simplified your map
initialization and the marker "setter", assigning new
objects directly to properties.
Fiddle:
https://jsfiddle.net/cbao9wLg/62/
$('#button').click(function() {
addmarker('-22.3157017', '-49.0660877', 'Infowindow test');
});
$('#button2').click(function() {
addmarker('-23.5936152', '-46.5856465', 'Infowindow test2');
});