在Clickign X按钮

时间:2015-07-10 14:16:40

标签: html5 twitter-bootstrap-3

我正在使用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值上运行。

1 个答案:

答案 0 :(得分:1)

您的代码缺少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不是引导类,但alert-danger(红色)是。

Bootply Example

Bootstrap Alert Documentation