I have a function that is being called in a click
event and has a $container
parameter defined
I'm trying to stop the process of that function, open a modal that has a save button and then continue with the original function by passing the click
event to the $container
parameter.
I have the following code but it does not work at all well, I explain them better in the code comment.
gm.addEditableAreaClick = function (container) {
$("#myModal").modal();
console.log(container);
//aquí el container cambia cada vez que hago click
$('.save-module').on("click", {param: container}, function(event){
console.log(event.data.param);
//aquí ya no cambia sino que se mantiene el que he clickado la primera vez y lo que me interesa es que cambie.
$(('.' + gm.options.gmToolClass + ':last'), event.data.param)
.before(elem = $('<div>').addClass(gm.options.gmEditRegion + ' ' + gm.options.contentDraggableClass)
.append(gm.options.controlContentElem + '<div class="' + gm.options.gmContentRegion + '">[moz_module]module-id[/moz_module]</div>')).before(cTagClose).prev().before(cTagOpen);
gm.initNewContentElem(elem);
});
};