Edit in JSFiddle

$('.modal-types button').on('click', function () {
    var type = $(this).attr('class').slice(5)
    swal(type + '!', '', type).catch(swal.noop)
  })
<div class="modal-types">
  <button class="type-success">Launch Success Message</button>
  <button class="type-error">Launch Error Message</button>
  <button class="type-info">Launch Info Message</button>
  <button class="type-warning">Launch Warning Message</button>
  <button class="type-question">Launch Question Message</button>  
</div>