当你第一次点击 “打开Summernote” 链接。 Ajax已成功加载 并且summernote按预期进行了初始化。
关闭模式框并单击“打开Summernote”链接。什么都没发生。
关闭模式框并单击“打开Summernote”链接。 Summernote按预期进行初始化。
关闭模式框并单击“打开Summernote”链接。什么都没发生。
....它会继续像这样。
我不知道在加载内容之前,接收到的ajax内容是否会包含summernote编辑器。 因此,在ajax成功函数中初始化summernote不是一个选项。
身体:
var $myModal = null;
$(document).ready(function() {
$myModal = $('#myModal');
$('.ajaxPopup').on('click', function() {
$.ajax({
url: 'modal.html',
type: 'GET',
context: this,
success: function (response) {
$myModal.find('.modal-title').html("Summernote");
$myModal.find('.modal-body').html(response);
$myModal.modal({
show: true,
backdrop: true
});
}
});
return false;
});
});
modal.html内容
$(function() {
$('#commentBox').summernote();
});
有什么建议?