title: Get value of Select2 for Google Map Api v3
body: <p>I recently changed my SELECT menu from the standard format to a Select 2 menu. Since this change my Value"" field seems to not be carrying the value to the map. When I select an item from the list it should trigger it's respective info box on the map to show, but his has stopped working. Any ideas?</p>
  
  <p>Google Map Code Sample:</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
      function initialize() {
          var latlng = new google.maps.LatLng(42.3443961,-71.0853170);
          var settings = {
              zoom: 14,
              center: latlng,
              mapTypeControl: true,
              mapTypeControlOptions: {style: google.maps.MapTypeControlStyle.DROPDOWN_MENU},
              navigationControl: true,
              navigationControlOptions: {style: google.maps.NavigationControlStyle.SMALL},
              mapTypeId: google.maps.MapTypeId.ROADMAP};
          var map = new google.maps.Map(document.getElementById("map_canvas"), settings);
  
  &lt;!--START Boston Medical Center--&gt;      
          var contentStringboscen = '&lt;div class="contentmap"&gt;'+
              '&lt;div id="siteNotice"&gt;'+
              '&lt;/div&gt;'+
              '&lt;h2 id="firstHeading" class="firstHeading"&gt;Boston Medical Center&lt;/h2&gt;'+
              '&lt;div id="bodyContent"&gt;'+
              '&lt;p&gt;Boston Medical Center (BMC) is a 496-bed academic medical center located in Boston’s historic South End. The hospital is the primary teaching affiliate for Boston University School of Medicine.&lt;/p&gt;'+
              '&lt;/div&gt;'+
              '&lt;/div&gt;';
          var infowindow = new google.maps.InfoWindow({
              content: contentStringboscen
          });
  
          var boscenImage = new google.maps.MarkerImage('images/map-icons/local-attractions/a.png',
              new google.maps.Size(40,50),
              new google.maps.Point(0,0),
              new google.maps.Point(50,50)
          );
  
          var boscenShadow = new google.maps.MarkerImage('images/map-icons/local-attractions/a-shadow.png',
              new google.maps.Size(40,50),
              new google.maps.Point(0,0),
              new google.maps.Point(65, 50));
  
          var boscenPos = new google.maps.LatLng(42.3344236,-71.0744651);
  
          var boscenMarker = new google.maps.Marker({
              position: boscenPos,
              map: map,
              icon: boscenImage,
              shadow: boscenShadow,
              title:"Boston Medical Center",
              zIndex: 3});
  &lt;!--STOP Boston Medical Center--&gt;
  
  &lt;!--START Boston Public Library--&gt;      
          var contentStringboslib = '&lt;div class="contentmap"&gt;'+
              '&lt;div id="siteNotice"&gt;'+
              '&lt;/div&gt;'+
              '&lt;h2 id="firstHeading" class="firstHeading"&gt;Boston Public Library&lt;/h2&gt;'+
              '&lt;div id="bodyContent"&gt;'+
              '&lt;p&gt;The Boston Public Library (est.1848) is a municipal public library system in Boston, Massachusetts, United States. It was the first publicly supported municipal library in the United States, the first large library open to the public in the United States, and the first public library to allow people to borrow books and other materials and take them home to read and use.&lt;/p&gt;'+
              '&lt;/div&gt;'+
              '&lt;/div&gt;';
          var infowindow = new google.maps.InfoWindow({
              content: contentStringboslib
          });
  
          var boslibImage = new google.maps.MarkerImage('images/map-icons/local-attractions/b.png',
              new google.maps.Size(40,50),
              new google.maps.Point(0,0),
              new google.maps.Point(50,50)
          );
  
          var boslibShadow = new google.maps.MarkerImage('images/map-icons/local-attractions/b-shadow.png',
              new google.maps.Size(40,50),
              new google.maps.Point(0,0),
              new google.maps.Point(65, 50));
  
          var boslibPos = new google.maps.LatLng(42.349484,-71.077740);
  
          var boslibMarker = new google.maps.Marker({
              position: boslibPos,
              map: map,
              icon: boslibImage,
              shadow: boslibShadow,
              title:"Boston Public Library",
              zIndex: 3});
  &lt;!--STOP Boston Public Library--&gt;
  
          google.maps.event.addListener(boscenMarker, 'click', function() {
              infowindow.setContent(contentStringboscen);
              infowindow.open(map,boscenMarker);
          });
          google.maps.event.addListener(boslibMarker, 'click', function() {
              infowindow.setContent(contentStringboslib);
              infowindow.open(map,boslibMarker);
          });
  
          var selectChoices = {
              boscenChoice: boscenMarker,
              boslibChoice: boslibMarker,
          };
  
          google.maps.event.addDomListener(
              document.getElementById("selectLocation"), 'change',
              function() {
              google.maps.event.trigger(selectChoices[this.value], "click");
          });
  
      }
  &lt;/script&gt;
  </code></pre>
  
  <p>Select2 Code:</p>
  
  <pre><code>&lt;link type="text/css" rel="stylesheet" href="select2/select2.css"&gt;
  &lt;script src="select2/select2.js"&gt;&lt;/script&gt;
  &lt;script&gt;
  var men=jQuery;
      men.noConflict();
  men(document).ready(function() {
  men('#selectLocation').select2(
      {
          placeholder: "Choose an Attraction",
          width:'400px',
          formatResult: format,
          formatSelection: format,
      });
  function format(option) {
      if (option.id.indexOf('Choice') != -1) {
          return "&lt;span style='display:inline-block;width:20px'&gt;" + option.text.substring(0,2) + "&lt;/span&gt;" + option.text.substring(2)
      } else {
          return option.text
      }
  }
  });
  &lt;/script&gt;
  </code></pre>
  
  <p>Select2 Menu:</p>
  
  <pre><code>&lt;div class="general-bg" style="background-color:#ffffff; border-bottom:solid 1px #cccccc"&gt;
      &lt;div id="map-nav" style="width:400px;margin:10px auto 10px auto; background-color:#ffffff;"&gt;
          &lt;select id="selectLocation" style="color:#09F; font-size:18px; font-family:'Century Gothic W01';" name="categories"&gt;
              &lt;option&gt;&lt;/option&gt;
              &lt;option value='boscenChoice'&gt;A. Boston Medical Center&lt;/option&gt;
              &lt;option value='boslibChoice'&gt;B. Boston Public Library&lt;/option&gt;
              &lt;option value='chrcenChoice'&gt;C. Christian Science Center&lt;/option&gt;
              &lt;option value='chuapaChoice'&gt;D. Church Park Apartments&lt;/option&gt;
              &lt;option value='copplaChoice'&gt;E. Copley Place Shopping&lt;/option&gt;
              &lt;option value='fenparChoice'&gt;F. Fenway Park&lt;/option&gt;
              &lt;option value='findisChoice'&gt;G. Financial District&lt;/option&gt;
              &lt;option value='houbluChoice'&gt;H. House of Blues&lt;/option&gt;
              &lt;option value='huntheChoice'&gt;I. Huntington Theatre&lt;/option&gt;
              &lt;option value='isamusChoice'&gt;J. Isabella Stewart Gardener Museum&lt;/option&gt;
              &lt;option value='logairChoice'&gt;K. Logan International Airport&lt;/option&gt;
              &lt;option value='lonmedChoice'&gt;L. Longwood Medical and Academic Area&lt;/option&gt;
              &lt;option value='mashosChoice'&gt;M. Massachusetts General Hospital&lt;/option&gt;
              &lt;option value='mastecChoice'&gt;N. Massachusetts Institute of Technology&lt;/option&gt;
              &lt;option value='musartChoice'&gt;O. Museum of Fine Arts&lt;/option&gt;
              &lt;option value='newstrChoice'&gt;P. Newbury Street Shopping&lt;/option&gt;
              &lt;option value='prucenChoice'&gt;Q. Prudential Center Shopping&lt;/option&gt;
              &lt;option value='pubgarChoice'&gt;R. Public Garden&lt;/option&gt;
              &lt;option value='symhalChoice'&gt;S. Symphony Hall&lt;/option&gt;
          &lt;/select&gt;
      &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>