Check out example codes for "sweetalert2 example html". It will help you in understanding the concepts better.
Code Example 1
<script src="https://cdn.jsdelivr.net/npm/[email protected]"></script>
Code Example 2
$.sweetModal.prompt('Can I haz cheezeburger?', 'Can I?', 'Nope', function(val) {
$.sweetModal('You typed: ' + val);
});
Code Example 3
swal({
title: "Deleted!",
text: "Your row has been deleted.",
button: "Close", // Text on button
icon: "success", //built in icons: success, warning, error, info
timer: 3000, //timeOut for auto-close
buttons: {
confirm: {
text: "OK",
value: true,
visible: true,
className: "",
closeModal: true
},
cancel: {
text: "Cancel",
value: false,
visible: true,
className: "",
closeModal: true,
}
}
});
Code Example 4
<script src="https://cdn.jsdelivr.net/npm/[email protected]"></script>
Learn ReactJs, React Native from akashmittal.com