Skip to content

Instantly share code, notes, and snippets.

@lnickers2004
Created January 15, 2014 03:22
Show Gist options
  • Save lnickers2004/8430206 to your computer and use it in GitHub Desktop.
Save lnickers2004/8430206 to your computer and use it in GitHub Desktop.
BOOTSTRAP3: HANDLING MODAL DIALOG EVENTS
(function()
{
//get a referenct to the dialog
var $sentDialog = $("#sentDialog");
debugger;
//register handler for the form's submittal
$("#contactForm").on("submit", function () {
debugger;
//show the modal dialog
$sentDialog.modal('show');
return false; //don't actually submit the form
});
//register some boostrap on handlers
$sentDialog.on("hidden.bs.modal", function () {
//do some work, save form, move onto another page etc
alert("hidden bs modal");
});
$sentDialog.on("focusin.bs.modal", function () {
//do some work, save form, move onto another page etc
alert("focus in bs modal");
});
$sentDialog.on("keyup.dismiss.bs.modal", function () {
//do some work, save form, move onto another page etc
alert("keyup.dismiss.bs.modal");
});
$sentDialog.on("click.dismiss.modal", function () {
//do some work, save form, move onto another page etc
alert("clicked dismiss modal");
});
$sentDialog.on("show.bs.modal", function () {
//do some work, save form, move onto another page etc
alert("show boostrap modal");
});
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment