答案来自老外http://*.com/questions/14795035/twitter-bootstrap-modal-blocks-text-input-field
$('#myModal').on('shown', function() {
$(document).off('focusin.modal');
});
这个是国内同学的解决方法:
http://www.oschina.net/question/226830_143869
//显示modal
$('#myModal').modal('show');
//show完毕前执行
$('#myModal').on('shown', function () {
//加上下面这句!解决了~
$(document).off('focusin.modal');
// 打开Dialog后创建编辑器
KindEditor.create('textarea[name="content"]', {
resizeType : 1
});
})
//hide完毕前执行
$('#myModal').on('hidden', function () {
// 关闭Dialog前移除编辑器
KindEditor.remove('textarea[name="content"]');
})
下面是我在项目中的应用,请大家注意加注释的那一句!
function computeMaskHeight() {
var obj = $("#blockLoading");
var parent = obj.parent();
obj.height(parent.height());
} function block(opt) {
var defaults = {
title: "",
showClose: true,
showOk: true,
showBottom: true,
showTitle: true,
showHead: true,
onOk: function() {
},
onShown: function(e) {
}
};
var setting = $.extend(defaults, opt);
$("#blockTitle").html(setting.title);
if (setting.showClose) {
$("#closeBlock, #closeBlockX").show();
} else {
$("#closeBlock, #closeBlockX").hide();
} if (setting.showOk) {
$("#blockOk").show();
} else {
$("#blockOk").hide();
}
$("#blockOk").unbind().click(function() {
setting.onOk();
}); if (setting.showBottom) {
$("#blockBottom").show();
} else {
$("#blockBottom").hide();
} if (setting.showHead) {
$("#blockHead").show();
} else {
$("#blockHead").hide();
}
$("#blockBody").html("<i class='icon-spinner icon-spin icon-4x'></i>");
$('#blockContainer').off('shown.bs.modal').on('shown.bs.modal', function (e) {
$(document).off('focusin.modal');//解决编辑器弹出层文本框不能输入的问题http://*.com/questions/14795035/twitter-bootstrap-modal-blocks-text-input-field
setting.onShown(e);
});
$("#blockContainer").modal(); }