You cannot use the default OK button because it will close the dialog, but you can hide the OK button and insert your own custom button like this:
spjs.dffs.alert({
"title": "Test required fields",
"msg": "Textarea:<br><textarea id='myTextarea' style='width:100%;height:75px;box-sizing:border-box;' onkeyup></textarea><br>Number:<br><input type='number' id='myNumber' style='width:100%;box-sizing:border-box;'><div style='color:red;display:none;' id='myFormValidation'>Please fill in both fields!</div><div style='text-align:right;padding-top:15px;'><input type='button' class='spjs-dlg-btn spjs-dlg-btnOK' onclick='customCloseFunc()' value='OK'>",
"noBtn": true
});
function customCloseFunc() {
var txt = jQuery("#myTextarea").val();
var num = jQuery("#myNumber").val();
if (txt !== "" && num !== "") {
// Save OK - continue with your code
spjs.dffs.closeDlg();
} else {
jQuery("#myFormValidation").show();
}
}
Alexander