Access to jquery selection while in context of a Google Maps Info Window
I have a web page that uses JQuery extensively, with no issues. It's basically a Google Map, with extra buttons, implemented as custom controls.
However, when I popup an Info Window, I want to put up some text in that window, but also a button. When the user clicks that button, I want something to happen (popup another small window).
My problem is, JQuery selectors don't seem to know about the markup in my Info Window.
Here's a piece of JavaScript that shows how I open the Google Maps InfoWindow:
contentString = contentString + '<input class=\"key\" id=\"dtmf55\" value=\"More\" type = \"button\" title=\"Click me for information !\">';
current_infowindow.setContent(contentString);
current_infow开发者_开发问答indow.open();
Elsewhere on the page, I have JQuery:
$("#dtmf55").click(function() {
alert ("Ya got me.");
});
I know the JQuery works, because I can put the same button elsewhere on the page, (not in an Info Window), and pressing the button fires the click function.
So how can I get my Info Window to have access to the same context? Or am I just profoundly on the wrong track?
Thanks,
you probably need to use a LIVE function
$("#dtmf55").live('click',function() {
alert ("Ya got me.");
});
That will bind click to a javascript generated element.
精彩评论