swal error code example

Example 1: swalert 2 show loader

Swal.fire({
                title: 'Please Wait !',
                html: 'data uploading',// add html attribute if you want or remove
                allowOutsideClick: false,
                onBeforeOpen: () => {
                    Swal.showLoading()
                },
            });

Example 2: sweet alert

<script src="https://cdn.jsdelivr.net/npm/sweetalert2@9"></script>

Example 3: swal fire types

swal({
  title: "Are you sure?",
  text: "Your will not be able to recover this imaginary file!",
  type: "danger",
  showCancelButton: true,
  confirmButtonClass: "btn-danger",
  confirmButtonText: "Yes, delete it!",
  closeOnConfirm: false
},
function(){
  swal("Deleted!", "Your imaginary file has been deleted.", "success");
});

Example 4: jquery sweet popup

$.sweetModal({
	title: {
		tab1: {
			label: 'Tab 1'
		},

		tab2: {
			label: 'Tab 2'
		}
	},

	content: {
		tab1: 'Tab 1',
		tab2: 'Tab 2'
	},

	buttons: {
		someOtherAction: {
			label: 'Action 2',
			classes: 'secondaryB bordered flat',
			action: function() {
				return $.sweetModal('You clicked Action 2!');
			}
		},

		someAction: {
			label: 'Action 1',
			classes: '',
			action: function() {
				return $.sweetModal('You clicked Action 1!');
			}
		},
	}
});

Tags:

Cpp Example