The following lines of code document what I'm trying to ac开发者_开发百科chieve. In detail, I'm trying to attach an addListener
to a DOM object. Sadly it seems that I can't access it.
var dom_obj = document.getElementById( 'dom_obj_id' );
console.log( typeof dom_obj ); // console: object
google.maps.event.addListener( dom_obj, 'click', function() {
// the following two lines don't appear
alert( 'Test - called from addListener' );
console.log( dom_obj );
} );
jQuery( zoom_in ).click(
function() {
// works
alert( 'Test - called via jQuery click function' );
console.log( dom_obj );
return false;
}
);
Searched for hours and found the solution seconds after typing the Q...
Simple as it is: Use addDomListener
instead.
精彩评论