Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

282
Visualizações
Button text not showing in SweetAlert

enter image description here

I don't really know what I am doing wrong here. SweetAlert work well, but not showing the button text.

swal({
    title: "Are you sure?",
    text: "Once deleted, you will not be able to recover this imaginary file!",
    icon: "warning",
    buttons: true,
    dangerMode: true,
});
about 4 years ago · Juan Pablo Isaza
2 Respostas
Responde à pergunta

0

Try to create a clean html page a try it out like this:

swal({
  title: "Are you sure?",
  text: "Once deleted, you will not be able to recover this imaginary file!",
  icon: "warning",
  buttons: true,
  dangerMode: true,
})
<script src="https://unpkg.com/sweetalert/dist/sweetalert.min.js"></script>

Probably the issue is with other scripts in your page as your code should work, instead you can try to use Sweetalert2 like this:

Swal.fire({
  title: 'Do you want to save the changes?',
  showCancelButton: true,
  confirmButtonText: 'CONFIRM',
  denyButtonText: `CANCEL`,
}).then((result) => {
  /* Read more about isConfirmed, isDenied below */
  if (result.isConfirmed) {
    // confirm button pressed
    console.log("confirm")
  } else if (result.isDismissed) {
    // deny button pressed
    console.log("deny")
  }
})
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11.1.9/dist/sweetalert2.all.min.js"></script>

EDIT:

Try to add jquery in your HTML page before other script imports like this:

<script src="https://cdn.jsdelivr.net/npm/jquery@3.6.0/dist/jquery.min.js"></script>
about 4 years ago · Juan Pablo Isaza Relatório

0

here is the answer

swal({
                title: "Are you sure?",
                text: "Once deleted, you will not be able to recover this imaginary file!",
                type: "warning",
                showCancelButton: true,
                confirmButtonColor: '#DD6B55',
                confirmButtonText: 'Yes',
                cancelButtonText: "No",
                closeOnConfirm: false,
                closeOnCancel: false
            },

Or

swal({
  text: "Once deleted, you will not be able to recover this imaginary file!",
  buttons: ["Yes", "No"],
});

or

<script src="https://unpkg.com/sweetalert/dist/sweetalert.min.js"></script>

swal("Are you sure you want to do this?", {
  buttons: ["Yes", "No"],
});
about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda