简体   繁体   中英

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:

<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.

bootply example

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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