Por alguna razón, jQuery.off ('clic') no parece estar funcionando aquí. Cuando se hace clic en el botón "Sí" en el modelo, aparece otro modelo. ¿Qué estoy haciendo mal?jQuery.off() no está eliminando el enlace
código:
$(function(){
//If there are warnings on the page bind alert
if ($('.renewal-warning').length > 0){
(function(){
$('#signRentalContainer').on('click', '.renewal-warning', function(e){
var buttonHandle = this;
//Prevent submission
e.preventDefault();
//Show warning model
$.modal({
content: $('#renewalWarning').html(),
title: "Order Renewal Warning",
buttons: {
'Yes': function(win) { $(buttonHandle).off('click').click(); },
'No': function(win) { win.closeModal(); }
},
maxWidth: 250,
closeButton: false
});
});
})();
}
});
¿Por qué no funciona el mango en este caso? Pensé que jQuery cambió el alcance para que coincida con el evento? – Steven
@Steven: Oh, ¿es por eso que estás haciendo el '.off()'? Supongo que el evento está burbujeante. En lugar de 'off()', intente agregar 'e.stopPropagation()' al manejador. –
... o tal vez sea por el '.click()' que estás haciendo en el elemento que ya ha sido cliqueado. ¿Por qué está ahí? Intenta eliminarlo –