I’d like to make a condition and call a swal for each one Sweetalert2). But only one of the swal runs. How can I do it?
function validateEmailemail) {
var regex = /\S+@\Snxdch/;
return regex.testemail);
}
function validateBirthdata) {
var regex = /^[0-9]{2})\/[0-9]{2})\/[0-9]{4})$/;
return regex.testdata);
}
function validacao) {
var data = document.getElementById’birth’).value;
var email = document.getElementById’email’).value;
if !validateBirthdata)) {
swal
‘title..’,
‘text..’,
‘type..’
);
}
if !validateEmailemail)) {
swal
‘title..’,
‘text..’,
‘type..’
);
}
}
<plhdws
There’s swal.queue), use it for multiple modals.
Your case should look like this:
var modals = [];
// birth modal
if !validateBirthdata)) {
modals.push{title: ‘title1’, text: ‘text1’, … });
}
// email modal
if !validateEmailemail)) {
modals.push{title: ‘title2’, text: ‘text2’, … });
}
swal.queuemodals);