There's sweet Alert version 1 and 2.
Actual version 2 works with HTML nodes.
I have a Sweet Alert 2 with a data form that looks this way:
var form = document.createElement("div");
form.innerHTML = `
0 hours
οnchange="window.changeHours(this.value)"
οninput="window.changeHours(this.value)"
>
0 min
οnchange="window.changeMinutes(this.value)"
οninput="window.changeMinutes(this.value)"
>`;
swal({
title: 'Request time to XXX',
text: 'Select time to send / request',
content: form,
buttons: {
cancel: "Cancel",
catch: {
text: "Create",
value: 5,
},
}
}).then((value) => {
console.log(value);
});
window.changeHours = function (value){
var tfHours = document.getElementById("tfHours");
tfHours.innerHTML = value;
}
window.changeMinutes = function (value){
var tfMinutes = document.getElementById("tfMinutes");
tfMinutes.innerHTML = value;
}