title: JavaScript function execute only the first time
body: <p>I have this function and  it works fine the first time but when I try to execute it second time it doesn't work, why is that?</p>
  
  <pre><code>$("#miBoton").on('click', function() {
    var text = $("#myText").val();
    map.data.forEach(function(feature) {
      if (text == feature.getProperty('SECTION')) {
        map.data.revertStyle();
        map.data.overrideStyle(feature, {
          strokeWeight: 8
        });
        var x = feature.getProperty("CX");
        var y = feature.getProperty("CY");
        var center = {
          lat: y,
          lng: x
        };
        infoWindow = new google.maps.InfoWindow({
          position: center
        });
        var contentString = '&lt;div class="infoSection"&gt;' +
          '&lt;div  class="iwTittle"&gt;' +
          '&lt;h3 style="margin-top:0px!important; margin-bottom:0px!important; padding:0px;"&gt; Seccion :' + feature.getProperty('SECTION') + '&lt;/h3&gt;' +
          '&lt;/div&gt;' +
  
          '&lt;div id="bodyContent"&gt;' +
          '&lt;h4&gt; Distrito :' + feature.getProperty('DLOCAL') + '&lt;/h4&gt;' +
          '&lt;iframe src="../window.php?section=' + feature.getProperty('SECTION') + '" style="width:100%; height:350px; border:0px"&gt;&lt;/iframe&gt;'
        '&lt;/div&gt;' +
        '&lt;/div&gt;';
        infoWindow.setContent(contentString);
        infoWindow.open(map);
      }
    });
    var text = null;
  });
  </code></pre>