Skip to content

Instantly share code, notes, and snippets.

@makeusabrew
Last active November 14, 2016 09:59
Show Gist options
  • Save makeusabrew/4332514 to your computer and use it in GitHub Desktop.
Save makeusabrew/4332514 to your computer and use it in GitHub Desktop.
Bootbox 3.0.0 sample usage
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>My page</title>
<!-- CSS dependencies -->
<link rel="stylesheet" type="text/css" href="bootstrap.min.css">
</head>
<body>
<p>Content here. <a class="alert" href=#>Alert!</a></p>
<!-- JS dependencies -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script src="bootstrap.min.js"></script>
<!-- bootbox code -->
<script src="bootbox.min.js"></script>
<script>
$(document).on("click", ".alert", function(e) {
bootbox.alert("Hello world!", function() {
console.log("Alert Callback");
});
});
</script>
</body>
</html>
@joeyfoster
Copy link

I'm using Bootbox v3 to load a login form in an iframe. The form is hugely complicated so can't be handled by a bb dialogue. Is there a simple way to close the modal when the user hits the Login button (Submit)?

My code:

$(document).on("click", ".alert2", function(mylogin) {
bootbox.dialog({
title: "Login",
message: '< iframe style="border:0;" src="login.php" height="700" width="100%" >< /iframe >'
});
});

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment