Uso el complemento select2 en mi script. Si realiza una alerta al cargar una página, obtiene esta situación
Swal.fire({ title: 'Are you sure?', text: "You won't be able to revert this!", type: 'warning', showCancelButton: true, confirmButtonColor: '#3085d6', cancelButtonColor: '#d33', confirmButtonText: 'Yes, delete it!' }).then(function() { Swal.fire( 'Deleted!', 'Your file has been deleted.', 'success' ); })
Al mismo tiempo, si usa el botón para mostrar una notificación, no hay tal problema. ¿Cómo se puede solucionar esto?
< button id = " button " >SHOWMODAL< / button > <script> $('#button').click(() => { Swal.fire({ title: 'Are you sure?', text: "You won't be able to revert this!", type: 'warning', showCancelButton: true, confirmButtonColor: '#3085d6', cancelButtonColor: '#d33', confirmButtonText: 'Yes, delete it!' }).then(function() { Swal.fire( 'Deleted!', 'Your file has been deleted.', 'success' ); }) }); </script>
Resuelto agregando una clase al controlador select2
$('select.form-control').select 2();