title: How to Access a Div inside Google Maps InfoBox?
body: <p>I am trying to select a <code>&lt;div&gt;</code> using jquery's <code>$('#divname')</code> inside a infobox that Google Maps generate when any of the many markers on the map are clicked on.</p>
  
  <p><strong>Problem:</strong> When I try to access the div using <code>$("#gallery")</code> after the marker has been clicked on, aka inside the click event listener of that marker, nothing happens. I tried getting the html contained in that div from the click listener using <code>console.log($("#gallery").html())</code> and it returns <code>null</code>!! How can I select this div!?</p>
  
  <p><strong>Click Event Listener Snippet Code</strong></p>
  
  <pre><code>// Create Listeners
  markers[i]._index = i;
  google.maps.event.addListener(markers[i], 'click', function() {
  
      infoboxes[this._index].open(map, markers[this._index]);
      infoboxes[this._index].show();
      console.log($('#gallery').html());
  </code></pre>
  
  <p>});</p>
  
  <p><strong>Infobox Snippet Code</strong></p>
  
  <pre><code>for( i = 0; i &lt; json.length; i++) {
  
      // Place markers on map
      var latLng = new google.maps.LatLng(json[i].lat, json[i].lng);
      var marker = new google.maps.Marker({
          position: latLng,
          map: map
      });
      markers.push(marker);
  
      // Create infowindows
      var boxText = '&lt;div id="infobox"&gt; \
                          &lt;div id="infobox_header_title"&gt; \
                              &lt;span id="infobox_header_price"&gt;$' + json[i].price + '&lt;/span&gt; \
                              &lt;span id="infobox_header_room"&gt;' + json[i].bedroom + 'br &lt;/span&gt; \
                              &lt;span id="infobox_header_address"&gt;' + json[i].address_1 + '&lt;/span&gt; \
                          &lt;/div&gt; \
                          &lt;div id="gallery"&gt; \
                              &lt;img src="images/cl/' +  json[i].photos[0] + '.jpg" /&gt; \
                              &lt;img src="images/cl/' +  json[i].photos[1] + '.jpg" /&gt; \
                          &lt;/div&gt; \
                      &lt;/div&gt;';
      var infoboxOptions = {
          content: boxText,
          disableAutoPan: false,
          maxWidth: 0,
          pixelOffset: new google.maps.Size(-140, 0),
          zIndex: null,
          boxStyle: { 
          },
          closeBoxMargin: "10px 2px 2px 2px",
          closeBoxURL: "http://www.google.com/intl/en_us/mapfiles/close.gif",
          infoBoxClearance: new google.maps.Size(1, 1),
          isHidden: true,
          pane: "floatPane",
          enableEventPropagation: false
          };
  
      var infobox = new InfoBox(infoboxOptions);
      infoboxes.push(infobox);
  
              //&lt;Click Event Listener code comes in here&gt;
  </code></pre>