A better way to show alerts in your next projects

A better way to show alerts in your next projects

ยท

1 min read

Are you bored with the default alert(); of the browser?

Even I am bored with that error ๐Ÿ˜”

But now not anymore, there is a powerful JavaScript library to create amazing alerts - Sweet Alert

Let's create some amazing alerts

  • Import Sweet Alert to your project
    https://cdnjs.cloudflare.com/ajax/libs/sweetalert/2.1.2/sweetalert.min.js
    
  • Now let's create three different types of alerts 1) Success
    const success = () => {
    swal ( "Welcome!" ,  "Follow at @codewithsnowbit" ,  "success" )
    }
    
    2)Warn
    const warn = () => {
    swal ( "You forgot something!" ,  "Follow at @codewithsnowbit" ,  "warning" )
    }
    
    3) Error
    const error = () => {
     swal ( "Oops" ,  "Something's not right" ,  "error" )
    }
    
    Check out the live demo:

Thank you for reading

ย