       this._refreshControls()
       # console.log "controlled"
 
-      $(document).on 'click', '.updateAttributesInPopup', (e) =>
+      $(this.mapElement).on 'click', '.updateAttributesInPopup', (e) =>
         e.preventDefault()
-
         featureId = $(e.currentTarget).closest('.leaflet-popup-content').find('*[data-internal-id]').data('internal-id')
         newName = $(e.currentTarget).closest('.popup-content').find('input[type="text"]').val()
 

        #update popup
        this.popupize layer.feature, layer

        $(document).trigger('mapeditor:feature_update', layer.feature)

        widget._saveUpdates()
        false


    navigateToLayer: (layer) ->
      this.map.fitBounds layer.getBounds()


    removeLayer: (layer) ->
      this.map.removeLayer layer


    popupize: (feature, layer) ->
      popup = ""
