t4t5 / sweetalert

A beautiful replacement for JavaScript's "alert"
https://sweetalert.js.org
MIT License
22.4k stars 2.84k forks source link

Adding link images in a sweet alert modal dialog. #520

Closed Jimmaki closed 7 years ago

Jimmaki commented 8 years ago

How do I add a link (or more) image like: <a href="mylink.lol" target="_blank"><img src="myimage.png" alt="something"></a> inside the swal("Good job!", "You clicked the button!", "success") sweet alert modal?

sunilsmith commented 8 years ago

swal({ title: "SUCCESS !!!", text: "You have done it !!! ", imageUrl: "js/1.png" });

t4t5 commented 7 years ago

This project isn't going to support setting custom HTML as strings, as I think it reinforces bad design patterns. If you want a custom modal, it should be built from scratch or using another library. SweetAlert just aims at providing a better version of alert with some extra features, NOT replace all your modals. :)

Jimmaki commented 7 years ago

Sorry for late response, fixed! https://jimmydance.com/contact-jimmy.html?r=1

sunilsmith commented 7 years ago

@Jimmaki may i know how you did that with swal ?

Jimmaki commented 7 years ago

@sunilsmith

As you can see here I copy and paste the whole FOOTER section (html) in the TEXT field of SWAL.

Example: swal({title: "Your message has been sent!!" , text: "

<a href=\"anylink.com\" target=\"_blank\" class=\"// I added a sprite image like spr3-wslogo\">
",

*Don't forget to escape special characters

Let me know if it works

jkjha commented 6 years ago

Hi @Jimmaki can you paste your code in text.. I tried to add the html like above but it didn't work for me.

Jimmaki commented 6 years ago

Hi there

SweetAlert Jimmy.zip

dhia06 commented 3 years ago

Hi, how can i a use an image as a background(not an Icon ) for the sweet alert. thanks