JSFiddle - React, Tailwind, and code Playground
by Alexey Demin
HTML
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/sweetalert2.all.min.js"></script>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@sweetalert2/[email protected]/dark.min.css">
JavaScript
Swal.fire({
title: 'Select documents for imports',
html: 'Alcool <input type="checkbox" id="alcool" value=""/></h3><p/>' +
'<h3>Cigarro <input type="checkbox" id="cigarro" /></h3>',
confirmButtonText: 'confirmar',
preConfirm: () => {
var alcool = Swal.getPopup().querySelector('#alcool').checked
var cigarro = Swal.getPopup().querySelector('#cigarro').checked
console.log("Alcool = " + alcool + " Cigarro = " + cigarro)
return {
alcool: alcool,
cigarro: cigarro
}
}
}).then((result) => {
Prescricao.usoAlcoolica = result.value.alcool
Prescricao.usoCigarro = result.value.cigarro
Swal.fire(`Babe?: ${result.value.alcool}\nFuma?: ${result.value.cigarro}`)
});