Skip to content

Instantly share code, notes, and snippets.

@lnickers2004
Created January 15, 2014 05:23
Show Gist options
  • Save lnickers2004/8431262 to your computer and use it in GitHub Desktop.
Save lnickers2004/8431262 to your computer and use it in GitHub Desktop.
Bootstrap3: ALERT closing and resetting when a dialog is closed, followed by closing the confirmation alert
<script>
(function()
{
$sentDialog.on("hidden.bs.modal", function () {
//do some work, save form, move onto another page etc
//show the Alert
$("#sentAlert").show();
});
var $sentAlert = $("#sentAlert");
//handle the getting ready to close event ...
//careful don't handle closed.bs.alert because that fires after dom removal
$sentAlert.on("close.bs.alert", function () {
$sentAlert.hide();//hide it only
return false;//don't remove it from the DOM in cases where we wish to reuse the alert over and over
});
})();
</script>
<!-- HERE IS THE ALERT ONLY SEE OTHER GIST FOR DIALOG-->
<div class="alert alert-warning collapse" id="sentAlert">
<a href="#" data-dismiss="alert" class="close">&times;</a>
<p>This doesn't work. Its not real!</p>
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment