JSFiddle - React, Tailwind, and code Playground
by misbahmunirinalkhafadh
HTML
<script src="https://cdnjs.cloudflare.com/ajax/libs/sweetalert/1.1.3/sweetalert.min.js"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/sweetalert/1.1.3/sweetalert.min.css">
<select id="dept-manager">
<option selected="selected" disabled="disabled">choose</option>
<option value="volvo">Volvo</option>
<option value="saab">Saab</option>
<option value="mercedes">Mercedes</option>
<option value="audi">Audi</option>
</select>
JavaScript
var prev_val;
$('#' + "dept-manager").focus(function() {
prev_val = $(this).val();
})
.change(function(e) {
var select = this;
$(this).blur();
var test = document.getElementById("dept-manager").value;
return swal({
title: "Information!",
text: test + " Will be receive notification from you to make RFPA after save this sales order",
type: "info",
html: true,
showCancelButton: true,
confirmButtonColor: "#DD6B55",
confirmButtonText: "Yes",
cancelButtonText: "No",
closeOnConfirm: true,
closeOnCancel: true
},
function(isConfirm) {
if (isConfirm) {
e.preventDefault();
return true;
} else {
$(select).val(prev_val);
return false;
}
});
});