Home > Web Front-end > JS Tutorial > Solve the problem that modal in bootstrap cannot close the page when it encounters the Esc key_javascript skills

Solve the problem that modal in bootstrap cannot close the page when it encounters the Esc key_javascript skills

WBOY
Release: 2016-05-16 16:11:00
Original
1374 people have browsed it

Bootstrap provides us with many convenient page controls, modal is one of them. Many people have encountered the problem that modal cannot be closed by pressing the esc key, and it does not take effect even if the keyboard option is explicitly passed in.

$('#editFormItemModal').modal({show:true, keyboard:true});

This problem occurs in versions 2.1 and later. It is very simple to solve this problem. Just add a tabindex attribute to the div where the modal is located:

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template