In this example, we can see how Bootstrap handles dismissible alerts:
<div class="alert alert-warning alert-dismissible" role="alert">
<button type="button" class="close" data-dismiss="alert" aria-label="Close">
<span aria-hidden="true">×</span></button>
<strong>Warning!</strong> Better check yourself, you're not looking too good.
</div>
I am curious about the mechanism behind the JavaScript handler attached to the button
that closes the corresponding div
element. What happens if there are multiple div
elements with the same classes and attributes - how does the framework identify the correct one to hide?
P.S. I wonder if the functionality will still be reliable if the role="alert"
attribute is removed.