gpt4 book ai didi

twitter-bootstrap - 如何禁用 Twitter Bootstrap 模式的 Escape 键?

转载 作者:行者123 更新时间:2023-11-30 23:48:32 24 4
gpt4 key购买 nike

在显示的模态中有一个表格。如果我专注于输入字段(与此相关的任何字段)并按 ESC 键,则该模式将被隐藏。但是,如果我不关注表单字段,则按 ESC 键不会关闭模式。这是怎么回事?

我想完全禁用模式的 ESC 键功能。我试过这个:

$(document).on('keypress', function(e) {
if(e.keyCode == 27) {
e.preventDefault();
return false;
}
}

但这不会影响任何事情。有没有办法完全禁用模式的 ESC 键?

最佳答案

通过添加 data-keyboard="false"解决问题。

像这样:<div class="modal hide fade" data-keyboard="false" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">

关于twitter-bootstrap - 如何禁用 Twitter Bootstrap 模式的 Escape 键?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16693079/

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