twitter/bootstrap — Issue #977: Closing alerts
Author: fingermark
Created: 2012-01-12 21:09:35+00:00
State: open

The demo page says that you can close alerts w/ the following code:

```javascript
$(".alert-message").alert('close')
```

But that does not work.

I checked out close() in bootstrap-alerts.js and it appears to assume that the a.close element will always be closing.

I had to modify the code as follows for it to work:

```javascript
close: function (e) {
var $element = $(this).parent('.alert-message')
if ($element.length == 0) $element = this.$element; // <-- added this line
```
There are certainly better solutions. Let me know if I'm incorrect and this is actually not a bug, but a user error.