Home >Web Front-end >Bootstrap Tutorial >How to close bootstrap modal box

How to close bootstrap modal box

藏色散人
藏色散人Original
2019-07-26 11:02:184460browse

How to close bootstrap modal box

#How to close the bootstrap modal box?

data-dismiss="modal" is a custom HTML5 data attribute. Here it is used to close the modal window. With this attribute, the modal box can be closed when clicked.

Related introduction:

Modal is a subform that covers the parent form. Typically, the purpose is to display content from a separate source that can have some interaction without leaving the parent form. Subforms provide information, interaction, and more.

If you want to reference the plugin's functionality separately, then you need to reference modal.js. Alternatively, as mentioned in the Bootstrap Plugin Overview chapter, you can reference bootstrap.js or a minified version of bootstrap.min.js.

Usage

You can switch the hidden content of the modal plug-in:

Through the data attribute: Set the attribute on the controller element (such as a button or link) data-toggle="modal", and set data-target="#identifier" or href="#identifier" to specify the specific modal box (with id="identifier") to be switched.

Via JavaScript: Using this technique, you can call a modal with id="identifier" with a simple line of JavaScript:

$('#identifier').modal(options)

Related recommendations: "bootstrap Tutorial

The above is the detailed content of How to close bootstrap modal box. For more information, please follow other related articles on the PHP Chinese website!

Statement:
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