1 2 3 4 5 6 7 8 9 10 11 12 |
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
1 2 3 4 5 6 7 8 9 10 11 |
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/