부트 스트랩 모달에 줄 바꿈을 추가하는 방법
-
26-12-2019 - |
문제
드라이 부트 스트랩 모달에 줄 바꿈을 추가하지 않고 실패했습니다.
여기에 메시지를 모달 쇼 코드로 보내는 내 하이퍼 링크 템플릿 코드입니다.
<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> <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로 변경하십시오.텍스트는 텍스트와 .html이 HTML로 작동하고 SPAN 태그에 줄 바꿈과 CSS를 표시합니다.
$('#deleteConfirmModal').find('.modal-body').html($(this).attr('delete-confirm'));
.
코드에서 작동합니다.'and "(단일 & 더블 말하기 마크)를 사용하십시오. 섞지 마십시오.
제휴하지 않습니다 StackOverflow