Bootstrap modal box Esc key does not close

Source: Internet
Author: User

When developing a project, a popup is often needed, and many frames have their own pop-up boxes, which compare the current popular bootstrap with modal frames.

Most of the time this thing is very convenient to use, you can save a lot of time for the development of their own definition! Bootstrap is also used in recent projects, as well as its modal frame model. It's really cool to use, just $ ("#popbox"). Model ("show"). But the cool, the bug also comes!

The reason is that I need to define some events and methods and some variables in the popup box! However, when I click on an element to make a change in a variable, the user accidentally pressed the ESC, the tragedy occurred, the value of the variable because you have just been clicked to produce a variable, but the fact does not produce interaction, but the popup box has been ESC off!

That makes the subsequent operation produced a bug, have to refresh the page to return to normal! Obviously, the ESC operation most of the situation is wrong operation, but, since the discovery of the bug, it is necessary to find ways to avoid it! Fortunately, the development of Bootstrap has already predicted the relevant situation! only need

$ ("#popbox"). Model ({show:true, keyboard:false}), yes, disable the keyboard from manipulating the modal frame! This way, even if you press ESC with the power of your breast, it won't turn off!

Bootstrap modal box Esc key does not close

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.