swal弹窗,sweetalert2具有相同功能的多个swal

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);

Published by

风君子

独自遨游何稽首 揭天掀地慰生平

发表回复

您的电子邮箱地址不会被公开。 必填项已用 * 标注