我正在使用 Bootstrap 3,当单击 x 按钮时我的警告元素没有关闭。
<div runat ="server" class="alert alert-error modalEditError"
id="modalEditError"
visible ="false">
<button class="close" type="button" data-dismiss="modalEditError">×</button>
<strong>The updated interview information was not saved!</strong>
<div id="Div2" runat="server"></div>
</div>
注意: CSS 类“modalEditError”并不真正存在;那是我试图让事情关闭,以防机制在类名而不是 id 值上起作用。
最佳答案
您的代码缺少 alert-dismissible
类,按钮上的 data-dismiss
应该以 alert
为目标:
<div class="alert alert-danger alert-dismissible" runat ="server" id="modalEditError" visible ="false">
<button class="close" type="button" data-dismiss="alert">×</button>
<strong>The updated interview information was not saved!</strong> <div id="Div2" runat="server" ></div>
</div>
另请注意,alert-error
不是 Bootstrap 类,但 alert-danger
(红色)是。
关于html - Bootstrap 警报不会在单击 X 按钮时关闭,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31343096/