Leaflet views how add marker by click? I'm using the module Leaflet and IP Geolocation Views &amp; Maps to display the marker, I need to give the ability to add markers with the mouse click. I'm trying to add a mark on the map Leaflet, with the following code. But for some reason it does not work, if someone can tell what is the reason?

(function ($) {
    $(document).ready (function(){
        $(document).bind('leaflet.feature', function(e, lFeature, feature){
        lFeature.on('click', function(e) {
          var lMap = Drupal.settings.leaflet[0].lMap;
          var marker = lMap.marker(e.latlng).addTo(lMap);
        })
      });
    });
})(jQuery);
I got a solution as follows:

(function($){
    $(document).ready(function(){

    var lMap = Drupal.settings.leaflet[0].lMap;
    lMap.on('click', function(e) {
            marker = new L.marker(e.latlng).addTo(lMap);
    });

    });
})(jQuery);