最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - is it possible to embedd HTML in an alertify.js alert? - Stack Overflow

programmeradmin2浏览0评论

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?

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?

Share Improve this question edited Jan 25, 2014 at 11:51 ArK 21.1k67 gold badges111 silver badges136 bronze badges asked Oct 16, 2013 at 2:55 pocketfullofcheesepocketfullofcheese 8,8479 gold badges43 silver badges57 bronze badges 1
  • Doesn't seem like you can, see here github./fabien-d/alertify.js/blob/0.3.11/src/alertify.js#L29, but try passing HTML, what happened?. Shameless link github./elclanrs/jquery.tiny.modal – elclanrs Commented Oct 16, 2013 at 2:58
Add a ment  | 

3 Answers 3

Reset to default 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>'));

Just pass html in message. For ex:

 alertify.error('<span> You should <a href="#">confirm</a> email </span>'); 

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.

发布评论

评论列表(0)

  1. 暂无评论