在模态框加载时,添加重写enforceFocus方法:
$.fn.modal.Constructor.prototype.enforceFocus = function() {};
我当时加在项目代码:
$('#myModal').modal({ backdrop: 'static', keyboard: false });
$.fn.modal.Constructor.prototype.enforceFocus = function () { };
$('#myModal').modal();