【发布时间】:2020-08-18 21:25:23
【问题描述】:
您好,当有人想删除帖子时,我需要使用提醒消息,要求她/他删除或取消
我试过了,但这是默认的警报浏览器
<button onclick="return confirm('are you sure you want to delete {{obj.title}}')" class="bt mx-auto"><a href="{% url 'posts:post-detail' obj.id %}"><img src="{% static 'icons/delete.svg' %}" alt=""></a></button>
我想使用此提醒
alertify.prompt("are you sure you want to delete ", "{{obj.title}}",
function(evt, value ){
alertify.success('Ok: ' + value);
},
function(){
alertify.error('Cancel');
});
但我不确定我应该将该脚本放在模板中的哪个位置?我在按钮 delete 中使用它,替换为 confirm() 但似乎不起作用
感谢您的帮助..
【问题讨论】:
标签: javascript django alertify alertifyjs