gpt4 book ai didi

html - 如何在引导模式中添加换行符

转载 作者:太空宇宙 更新时间:2023-11-04 14:36:37 25 4
gpt4 key购买 nike

我一直在尝试向 DRY 引导模式添加换行符,但未能成功。

这是我的超链接模板代码,用于将消息发送到模态显示代码:

<a href="{% url achievement_details_delete achievement_detail.id %}" delete-confirm="Are you sure you want to DELETE the selected record? <br /><br />This action will permanently remove the record.">Delete</a>

这是我的 jquery 引导模式代码:

$(document).ready(function() {

//START: Delete code.
$('a[delete-confirm]').click(function(ev) {

var href = $(this).attr('href');

if (!$('#deleteConfirmModal').length) {

$('body').append('<div id="deleteConfirmModal" class="modal modal-confirm-max-width" role="dialog" aria-labelledby="deleteConfirmLabel" aria-hidden="true"><div class="modal-header"><button type="button" class="close" data-dismiss="modal" aria-hidden="true">X</button><h4 class="modal-title" id="deleteConfirmLabel">{% trans "Delete" %} - {{ resume_details_trans }}</h4></div><div class="modal-body"></div><div class="modal-footer"><button class="btn" data-dismiss="modal" aria-hidden="true">{% trans "Cancel" %}</button>&nbsp;&nbsp;<a class="btn-u btn-u-red" id="deleteConfirmOK" onclick="showProgressAnimation();">{% trans "Delete" %}</a></div></div>');

}

$('#deleteConfirmModal').find('.modal-body').text($(this).attr('delete-confirm'));

$('#deleteConfirmOK').attr('href', href);

$('#deleteConfirmModal').modal({show:true});

return false;

});
//FINISH: Delete code.
});

最佳答案

将此添加到删除记录的按钮:

<a href="url"
delete-confirm="Your Message Here!!<br /><br /><span class='confirm_delete_warning_red_bold'>You can even add in css to highlight specific text - Are you sure?</span>"
>
Delete
</a>

然后在您的 jquery 代码中将 .text 更改为 .html。 Text 将呈现文本,而 .html 将充当 html 并在 span 标记中显示换行符和 css。

 $('#deleteConfirmModal').find('.modal-body').html($(this).attr('delete-confirm'));

这将适用于您的代码。请注意您对 ' 和 "(单和双说话标记)的使用。不要混淆它们。

关于html - 如何在引导模式中添加换行符,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25072197/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com