我试图找出关闭一个模式框动态使用jquery没有表单
I am trying to figure out closing a Modal Box Dynamically using jquery without a form
我正在尝试使用jQuery动态地找出一个没有表单的模态框。
<a href="#openModal">Open Modal</a>
<div id="openModal" class="modalDialog">
<div> <a href="#close" title="Close" class="close">X</a>
<h2>Modal Box</h2>
<p>This is a sample modal box that can be created using the powers of CSS3.</p>
<p>You could do a lot of things here like have a pop-up ad that shows when your website loads, or create a login/register form for users.</p>
</div>
试试下面的代码,它会帮助你
$('#openModal').modal('hide');
$('#openModal').modal().hide();
$('#openModal').removeClass('show');
<!DOCTYPE html>
<html lang="en">
<head>
<title>Bootstrap Example</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
</head>
<body>
<div class="container">
<h2>Basic Modal Example</h2>
<!-- Trigger the modal with a button -->
<button type="button" class="btn btn-info btn-lg" data-toggle="modal" data-target="#myModal">Open Modal</button>
<!-- Modal -->
<div class="modal fade" id="myModal" role="dialog">
<div class="modal-dialog">
<!-- Modal content-->
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">×</button>
<h4 class="modal-title">Modal Header</h4>
</div>
<div class="modal-body">
<p>Some text in the modal.</p>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
</div>
</body>
</html>
相关文章:
- 试图在引导模式内动态生成图表,得到offsetWidth错误
- 执行动态模式弹出
- 如何动态更改React Bootstrap模式的内容
- 动态加载引导模式主体
- 谷歌浏览器模式正则表达式在使用setCustomValidity动态创建表单时不起作用
- 设置多个观察程序以触发动态事件的角度替代解决方案 - 优化的观察者模式
- 在 jQuery 和 jqueryUI 模式框中动态更改 id
- 如何使模式窗口打开动态内容并更改url
- 动态添加ng模式,缺少验证类
- 动态淘汰模板模式潜在缺陷
- lightGallery动态模式不适用于Firefox和Safari
- 动态模式下的 lightGallery:单击时加载的图像不正确
- 调用动态模式引导程序进行登录
- 使用动态模式从JSON加载
- 设置Regexp中的动态模式
- 动态模式与表单 - 不屑一顾的发布数据
- javascript查找并替换字符串中的动态模式
- 动态模式Javascript
- 在 fmt:formatNumber 中获取动态模式
- 如何将nlobjColumn的动态模式.setURL工作