Search code examples
htmlcolorboxsweetalert2

colorbox href to sweetalert


I have to change a colorbox popup to sweetalert2 popup my issue is that I'm using href attribute in colorbox to get HTML content and I couldn't find the same method in sweetalert2

Is there a solution for it?

Thanks


Solution

  • You can use jquery's .get() Method to get the html data. What you would have to do is reference the html file.

    Your javascript code should look like this.

      $.get("yourFile.html", function (data) {
         swal({
           html: data
         });
      });
    

    Good luck!