Bootbox.js is a small JavaScript library which allows you to create programmatic dialog boxes using Bootstrap modals, without having to worry about creating, managing or removing any of the required DOM elements or JS event handlers. Here’s the simplest possible example:
index.html
<!DOCTYPE html>
<html>
<head>
<title>Bootstrap BootBox</title>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.2.0/jquery.min.js"></script>
<link rel="stylesheet" type="text/css" href="bootstrap/css/bootstrap.css">
<script type="text/javascript" src="bootstrap/js/bootstrap.js"></script>
<script type="text/javascript" src="js/bootbox.js"></script>
</head>
<body>
<button class="btn btn-success">Show Message</button>
<script type="text/javascript">
jQuery(document).ready(function($) {
$('button').on('click',function(e){
bootbox.confirm("Hello Developer", function(result){
if(result){
//to to controlelr method.
} else {
//todo.
}
});
})
});
</script>
</body>
</html>
Output:
Source: https://app.box.com/s/o8qcsntcpdx0nt12m4j7tupd80yhsjz1
0 comments:
Post a Comment