1
I use this plugin: http://bootstrap-confirmation.js.org/
Segue Jsfiddle: https://jsfiddle.net/oq0zcn94/79/
After clicking the "replaceWith" button, the "Confirmation" button no longer works.
Follows code:
$('#teste').confirmation();
$("#replaceWith").click(function() {
$('#teste').replaceWith('<button id="teste">Confirmação</button>');
});
The "Confirmation" button does not work after clicking the "replaceWith" button".
Update @Ricardopunctual:
Follows code:
$('[data-toggle=confirmation-document]').confirmation({
singleton: true,
popout: true,
rootSelector: '[data-toggle=confirmation-document]',
title: '',
content: '',
buttons: [
{
label: 'Criar',
onClick: function () {
//códigos
}
},
{
label: 'Apagar',
onClick: function () {
//códigos
}
}
]
});
Some solution ?
It is because the DOM has already been loaded. It puts the script inside the replaceWith that should work
– Victor Eyer
As the friend said, the gift has already been loaded, Istener listened to the old button and when changing it, the same is lost. Use another element instead of the button directly: $("body"). on("click", "#replaceWith", Function(){...})
– edson alves
I updated the fiddle here to set confirmation with the properties, so it gets good?
– Ricardo Pontual
@Ricardopunctual, yes. Thank you for helping me.
– Matheus Miranda