Remove "OK" button from sweet alert dialog

Update 4/6/2018

showCancelButton and showConfirmButton are no longer needed. Instead, you can set buttons: true to show both buttons, or buttons: false to hide all buttons. By default, only the confirm button is shown.

So now instead of doing

showCancelButton: false;

showConfirmButton: false;

Just do

buttons: false;

Guides


You need to set showConfirmButton:false in your configuration.

swal({
  title: 'Are you sure?',
  text: "You won't be able to revert this!",
  type: 'warning',
  showConfirmButton:false,
  confirmButtonText: 'Yes, delete it!'
})

Here's the fiddle


You can use these properties:

showCancelButton: false, // There won't be any cancel button
showConfirmButton: false // There won't be any confirm button

Like This

swal({
  title: 'Auto close alert!',
  text: 'I will close in 2 seconds.',
  timer: 2000,
  showCancelButton: false,
  showConfirmButton: false
}).then(
  function () {},
  // handling the promise rejection
  function (dismiss) {
    if (dismiss === 'timer') {
      //console.log('I was closed by the timer')
    }
  }
)