title: Click link inside Leaflet Popup and do Javascript
body: <p>I have a leaflet map up and running.  It overlays a series of polygons (via GeoJSON) on the map and attaches popups to each polygon. Each of the popups display information about that polygon.  </p>
  
  <p>I'd like to have inside the popup a link that, when clicked, runs a javascript function that pulls further smaller polygons via AJAX and shows them.  </p>
  
  <p>I can't get the script to catch a click on the link via the normal jQuery/Javascript click events.  Here's what I mean by normal (the following doesn't work):</p>
  
  <pre><code>$('a .smallPolygonLink').click(function(e){
    console.log("One of the many Small Polygon Links was clicked");
  });
  </code></pre>
  
  <p>The bindPopup part is as follows.  It runs on each polygon when made and it pops up correctly on clicking on a polygon.  It does show the link, just won't run the above code on click.</p>
  
  <pre><code>var popupContent = "Basic Information..." + '&lt;a class="smallPolygonLink" href="#"&gt;Click here to see the smaller polygons&lt;/a&gt;';
  layer.bindPopup(popupContent);
  </code></pre>
  
  <p>Here's a JSFiddle illustrating the example, though in a far simpler form. <a href="http://jsfiddle.net/2XfVc/4/">http://jsfiddle.net/2XfVc/4/</a></p>