How to make friends ajax with dynamically created links? I created leaflet map, when you hover the marker in popup window is a reference to the content.


I wrote module that loads ajax content in the custom region. For dynamic links added class use-ajax, but Drupal does not process them as I needed.
I check and found that static links with class use-ajax have additional class ajax-processing.
My dynamic link looks like:

&lt;a id="jslink" class="use-ajax" href="nojs/problem/83"&gt;засорение реки&lt;/a&gt;


Static link looks like:

&lt;a class="use-ajax ajax-processed" href="nojs/node/231"&gt;node&lt;/a&gt;


As I understand Ajax Drupal does not work with dynamic links.
I found issue in what asks in what need to change the href attribute of a link and make the ajax call to the new url.  Change &#39;href&#39; attribute in AJAX enabled links
Wrote JS code but it doesn't work for me. 

(function ($) {
  Drupal.behaviors.test_module = {
    attach: function (context, settings) {
        $("#jslink").click(function(){
            var href = $("#jslink").attr("href");
            Drupal.ajax['jslink'].options.url = href;

        });
    }
  };
})(jQuery);


Is it possible to somehow make Drupal to work with dynamic links?
What am I doing wrong?
I found solution, for loading balloons I use module IP Geolocation Views &amp; Maps it has js file ip_geoloc_leaflet_goto_content_on_click.js
where I add line Drupal.attachBehaviors(); 
Now it works as designed.

jQuery(document).bind('leaflet.feature', function(event, marker, feature) {
  // marker is the feature just added to the map, it could be a polygon too.
  // feature.feature_id is the node ID, as set by ip_geoloc_plugin_style_leaflet.inc
  // Need to set this up for code below.
  // The same code is used for cross-highlighting. See ip_geoloc_leaflet_sync_content.js
  if (feature.feature_id) {
    marker.feature_id = feature.feature_id;
  }
});

jQuery(document).bind('leaflet.map', function(event, map, lMap) {

  if (map.settings.gotoContentOnClick) {
    for (var leaflet_id in lMap._layers) {
      lMap._layers[leaflet_id].on('click', function(e) {
        var id = e.target ? e.target.feature_id : null;
        if (!id &amp;&amp; e.layer) id = e.layer.feature_id;
        if (id) {
            //document.location.href = Drupal.settings.basePath + 'node/' + id;
            document.location.href = Drupal.settings.basePath + 'load_node/' + id;
        }
      });
    }
  }
  if (map.settings.openBalloonsOnHover) {
    for (var leaflet_id in lMap._layers) {
      lMap._layers[leaflet_id].on('mouseover', function(e) {
        this.openPopup();
         Drupal.attachBehaviors(); &lt;&lt;&lt;&lt;--------ADDED LINE
      });
    }
  }

});