admin管理员组文章数量:1291145
i am working on a html page having an modal then if modal loads on page then if i press ESC key then modal closed , that is very unliking to me. how to prevent this.?? please note that modal using cakephp render. i tried this , but not working
$(document).keydown(function(e) {
if (e.keyCode == 27) return false;
});
i am working on a html page having an modal then if modal loads on page then if i press ESC key then modal closed , that is very unliking to me. how to prevent this.?? please note that modal using cakephp render. i tried this , but not working
$(document).keydown(function(e) {
if (e.keyCode == 27) return false;
});
Share
Improve this question
edited Aug 6, 2015 at 9:58
Manish Prajapati
asked Aug 6, 2015 at 9:17
Manish PrajapatiManish Prajapati
1,6412 gold badges14 silver badges21 bronze badges
5
- Where is the code of your modal? Post it here – hindmost Commented Aug 6, 2015 at 9:18
- are you usig jquery dialog or bootstrap modal? please post your code. – Umesh Sehta Commented Aug 6, 2015 at 9:23
- i am using bootstrap modal. – Manish Prajapati Commented Aug 6, 2015 at 9:40
- 1 i am using bootstrap modal. Then you have to indicate this in the question as well as in tags – hindmost Commented Aug 6, 2015 at 9:44
- possible duplicate of How to disable Escape Key for Twitter Bootstrap Modals? – hindmost Commented Aug 6, 2015 at 9:48
1 Answer
Reset to default 8add this attribute in your modal div
data-keyboard="false"
Example
<div id="myModal" data-keyboard="false">
</div>
本文标签: javascriptHow to disable ESC key on ModalStack Overflow
版权声明:本文标题:javascript - How to disable ESC key on Modal? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741525090a2383418.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论