swal({
title: 'Multiple inputs',
html:
'<input id="swal-input1" class="swal2-input">' +
'<input id="swal-input2" class="swal2-input">',
preConfirm: function () {
return new Promise(function (resolve) {
// Validate input
if ($('#swal-input1').val() == '' || $('#swal-input2').val() == '') {
swal.showValidationMessage("Enter a value in both fields"); // Show error when validation fails.
swal.enableConfirmButton(); // Enable the confirm button again.
} else {
swal.resetValidationMessage(); // Reset the validation message.
resolve([
$('#swal-input1').val(),
$('#swal-input2').val()
]);
}
})
},
onOpen: function () {
$('#swal-input1').focus()
}
}).then(function (result) {
// If validation fails, the value is undefined. Break out here.
if (typeof(result.value) == 'undefined') {
return false;
}
swal(JSON.stringify(result))
}).catch(swal.noop)
Code Example |
---|
Cpp :: loop execution descending order in c++ |
Cpp :: resharper fold statement |
Cpp :: cpp oop |
Cpp :: Initialize Vector Iterator |
Cpp :: c++ delay |
Cpp :: max c++ |
Cpp :: what is a variable in cpp |
Cpp :: c++ comment out multiple lines |
Cpp :: vector::at() || Finding element with given position using vector in C++ |
Cpp :: how to print items in c++ |
Cpp :: print elements of linked list |
Cpp :: arduino falling edge |
Cpp :: modular exponentiation algorithm c++ |
Cpp :: cpp malloc |
Cpp :: c++ write to file in directory |
Cpp :: loops in c and c ++ |
Cpp :: web dev c++ |
Cpp :: find factorial in c++ using class |
Cpp :: and c++ |
Cpp :: c++ check first character of string |
Cpp :: vector size c++ |
Cpp :: error in c++ |
Cpp :: c++ bit shift wrap |
Cpp :: pthread c++ example with output |
Cpp :: vector insert to end |
Cpp :: how to read rotary encoder c++ |
Cpp :: c shortest path dijkstra |
Cpp :: the number of ones int bitset |
Cpp :: what does map.count() return in c++ |
Cpp :: linq select where string equals "String" |