8

I wanted to use Alertify.js to embed a Qualtrics survey, but I do not know if it is possible to pass in an HTML snippet (possibly an iframe?) instead of just text for the message of the alert.

Does anyone know if it is possible or how it might be done?

ArK
  • 20,698
  • 67
  • 109
  • 136
pocketfullofcheese
  • 8,427
  • 9
  • 41
  • 57
  • Doesn't seem like you can, see here https://github.com/fabien-d/alertify.js/blob/0.3.11/src/alertify.js#L29, but try passing HTML, what happened?. Shameless link https://github.com/elclanrs/jquery.tiny.modal – elclanrs Oct 16 '13 at 02:58

3 Answers3

7

I figured out a way around this, with a little jQuery. Place the following after you trigger the alert:

$('.alertify-message').append($.parseHTML('<whatever><html><you><want>'));
pocketfullofcheese
  • 8,427
  • 9
  • 41
  • 57
6

Just pass html in message. For ex:

 alertify.error('<span> You should <a href="#">confirm</a> email </span>'); 
Iga Uga
  • 61
  • 1
  • 2
0

Here is the proper way to use custom HTML in an alert:

var alertifyObject = alertify.notify('Old content', 'error');
alertifyObject.setContent('<b>New content</b>');

setContent accepts either a string or a DOM object.

Alexey Kosov
  • 3,010
  • 2
  • 23
  • 32