Posted inTechnology / JavaScript / jQuery / php / Programming

how to use sweet alert in html?

Today, We want to share with you how to use sweet alert in html.In this post we will show you sweet alert html, hear for how to use sweet alert in php we will give you demo and example for implement.In this post, we will learn about how to use sweet alert in codeigniter? with an example.

how to use sweet alert in javascript?

Example 1: sweet alert 2 do action on confirm

Swal.fire({  
  title: 'Do you want to save the changes?',  
  showDenyButton: true,  showCancelButton: true,  
  confirmButtonText: `Save`,  
  denyButtonText: `Don't save product`,
}).then((result) => {    
    if (result.isConfirmed) {    
    	Swal.fire('Saved!', '', 'success')  
    } else if (result.isDenied) {    
    	Swal.fire('Product Changes are not saved', '', 'info')  
 	}
});

sweet alert js

swal({
     title: "Deleted!",
     text: "Your row has been deleted.",
     button: "Close", // Text on button
     icon: "success", 
     timer: 3000, 
      buttons: {
        confirm: {
          text: "OK",
          value: true,
          visible: true,
          className: "",
          closeModal: true
        },
        cancel: {
          text: "Cancel",
          value: false,
          visible: true,
          className: "",
          closeModal: true,
        }
      }
     });

sweet alert


Sweet Alert – Success Message

HTML Code

Sweet Alert.js

JS Code

$("button").click(function() {
  swal("Product Updated Successfully", "Good Luckk, you pressed a button", "success")
});

CSS Code

body{
  text-align: center;
  font-size: 14px;
  background-color: #DBE3E6;
}
h1{
  font-family: 'Pacifico', cursive;
  font-size: 6em;
  color: #252E40;
  line-height: 2.0em;
}
button{
  background-color: #F16669;
  border: none;
  padding: 15px 20px;
  color: white;
  font-size: 2em;
  margin-top: 40px;
  transition: 1s;
  cursor: pointer;
  border-radius: 4px;
}

button:hover{
  background-color: darken(#F16669, 30)
}

I hope you get an idea about sweet alert multiple inputs.
I would like to have feedback on my infinityknow.com blog.
Your valuable feedback, question, or comments about this article are always welcome.
If you enjoyed and liked this post, don’t forget to share.

I am Jaydeep Gondaliya , a software engineer, the founder and the person running Pakainfo. I'm a full-stack developer, entrepreneur and owner of Pakainfo.com. I live in India and I love to write tutorials and tips that can help to other artisan, a Passionate Blogger, who love to share the informative content on PHP, JavaScript, jQuery, Laravel, CodeIgniter, VueJS, AngularJS and Bootstrap from the early stage.

Leave a Reply

Your email address will not be published. Required fields are marked *

We accept paid guest Posting on our Site : Guest Post Chat with Us On Skype