简体   繁体   English

为什么单击关闭按钮后,可拒绝的警报不再出现?

[英]Why is the dismissible alert not showing up again after I click close button?

I was trying to use dismissible alert the same way as Bootstrap example shows: 我试图以与Bootstrap示例所示相同的方式使用可忽略的警报:

<div class="alert alert-warning alert-dismissible" role="alert">
  <button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">&times;</span></button>
  <strong>Warning!</strong> Better check yourself, you're not looking too good.
</div>

When the alert was shown, I clicked the close button. 显示警报时,我单击了关闭按钮。 The alert was gone and everything was fine. 警报消失了,一切都很好。 But when I fired the same trigger trying to bring back the alert, it was not showing up again. 但是,当我触发相同的触发器尝试恢复警报时,它没有再次显示。

Is this the expected behaviour for dismissible alerts? 这是可消除的警报的预期行为吗? How can I bring it back again? 我该如何将其重新带回? Thanks. 谢谢。

You can use jQuery's .show() and .hide() methods instead, "data-dismiss" removes the alert element from html. 您可以改用jQuery的.show()和.hide()方法,“ data-dismiss”从html删除alert元素。

bootply example 引导示例

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM