title: Using addEventListener To Handle jQuery Click Events On Selectors Inside Google Maps infoWindow With jQuery UI Maps
body: <p>The Problem: When trying to fire jQuery events on selectors within a Google Maps infoWindow, the click event listener required to catch events within the gmap object must be parent to other click functions, resulting in a failure for click events to fire on the first click.</p>
  
  <p>All the solutions I found here on StackOverflow showed how to add the eventListener, but still did not account for the failure to fire on first click issue.</p>
  
  <p>The solution below will work if you are using jQuery UI Maps to populate clickable markers that open infoWindows, and want to be able to target elements inside the infoWindow for jQuery events on your main (parent) page.</p>
  
  <p>This solution solves the typical first fire issue resulting from nested click functions, where jQuery events will not fire on the first click, since your functions must be within the addEventListener for $('map_canvas').gmap() in order to be caught - but then, of course, they would be nested within another click function and therefore wouldn't fire until the second time clicked.</p>
  
  <p>There are surely more standard and/or eloquent ways of achieving this, but aside from requiring slightly non-typical syntax, this solves all the issues and makes a very quick, straightforward, workable solution for an otherwise very frustrating problem, saving you the 8+ hours of wall head bashing it took me to produce.</p>