I’ve a function which accept only html string, it will show a info window (a popup) with the html as its content:
function createInfoWindow(info_html){
// show a popup with info_html as its content
}
Now I want to create a info window which will have a button:
function createMyInfoWindow(o){
var info_html = "<input type='button' value='click me' onclick='foo(o)'>"
createInfoWindow(info_html);
}
function foo(o){
console.log(o);
}
createMyInfoWindow({ name: "test", age: 21);
However, when I click the button, it says that o can’t be found.
Try following code
UPDATE
If o is object it becomes more complicated.
You can store passed objects in store-object. Then you can pass corresponding index in
foo: