[wd_asp elements=’search’ ratio=’100%’ id=1]

Sweet Alert Input box

12th October 2018

Jquery - Ajax

jquery icon

sweet alert save input text


Swal.fire({
title: "An input!",
text: "Write something interesting:",
input: 'text',
showCancelButton: true
}).then((result) => {
if (result.value) {
alert("Result: " +result.value);
}
});

If not try this code

const {value: email} = await swal({
title: 'Input email address',
input: 'email',
inputPlaceholder: 'Enter your email address'
})

if (email) {
swal('Entered email: ' + email)
}

If you need to save this to a database then this may help
/jquery/jquery-ajax/sweet-alert-text-input-and-save-to-a-database/