SweetAlert Image & Error
An image-reward dialog and a detailed error dialog, via SweetAlert2.
Requires Bootstrap 5, SweetAlert2. Add the CDN tags below to your page (styles in
<head>, scripts before </body>). The downloaded file already includes them.<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css"><script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js"></script><script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script><div class="d-flex gap-2"><button class="btn btn-primary" id="swImg">Image alert</button><button class="btn btn-outline-danger" id="swErr">Error dialog</button></div>document.getElementById('swImg').onclick=function(){Swal.fire({title:'Great job!',text:'You unlocked a badge.',imageUrl:'https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free@6/svgs/solid/trophy.svg',imageWidth:80,confirmButtonText:'Claim'})};
document.getElementById('swErr').onclick=function(){Swal.fire({icon:'error',title:'Oops…',text:'Something went wrong.',footer:'Contact support if it persists.'})};Free to use.This component uses Bootstrap 5, SweetAlert2 (linked above). Copy any file, or download a ready-to-open .html page with the CDN links already included.