bootbox prompt examples
by Markerleffe
HTML
<link rel="stylesheet" href="http://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.0.0/css/bootstrap.css">
<script src="http://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.0.0/js/bootstrap.js"></script>
<script src="https://rawgithub.com/makeusabrew/bootbox/master/bootbox.js"></script>
<div class="container">
<button id="default" class="btn btn-default">default prompt</button>
<button id="text-1" class="btn btn-default">text prompt</button>
<button id="text-2" class="btn btn-default">text prompt with default value</button>
<button id="text-3" class="btn btn-default">text prompt with placeholder</button>
<button id="email-1" class="btn btn-default">email prompt</button>
<button id="email-2" class="btn btn-default">email prompt with default value</button>
<button id="email-3" class="btn btn-default">email prompt with placeholder</button>
<button id="select-1" class="btn btn-default">select prompt</button>
<button id="select-2" class="btn btn-default">select prompt with default value</button>
<button id="checkbox-1" class="btn btn-default">checkbox prompt</button>
<button id="checkbox-2" class="btn btn-default">checkbox prompt with default value</button>
<button id="checkbox-3" class="btn btn-default">checkbox prompt with multiple default value</button>
</div>
CSS
.container .btn {
display: block;
margin: 5px;
}
JavaScript
jQuery("#default").on("click", function() {
bootbox.prompt(
"What's your name",
function(result) {
showResult(result);
}
);
});
jQuery("#text-1").on("click", function() {
bootbox.prompt({
title: "What's your name",
inputType: "text",
callback: function(result) {
showResult(result);
}
});
});
jQuery("#text-2").on("click", function() {
bootbox.prompt({
title: "What's your name",
inputType: "text",
value: "John Smith",
callback: function(result) {
showResult(result);
}
});
});
jQuery("#text-3").on("click", function() {
bootbox.prompt({
title: "What's your name",
inputType: "text",
placeholder: "enter your name",
callback: function(result) {
showResult(result);
}
});
});
jQuery("#email-1").on("click", function() {
bootbox.prompt({
title: "What's your email",
inputType: "email",
callback: function(result) {
showResult(result);
}
});
});
jQuery("#email-2").on("click", function() {
bootbox.prompt({
title: "What's your email",
inputType: "email",
value: "[email protected]",
callback: function(result) {
showResult(result);
}
});
});
jQuery("#email-3").on("click", function() {
bootbox.prompt({
title: "What's your email",
inputType: "email",
placeholder: "enter your email",
callback: function(result) {
showResult(result);
}
});
});
var options = [
{value: '#', text: 'Choose one'},
{value: 1, text: 'Vim'},
{value: 2, text: 'Sublime Text'},
{value: 3, text: 'WebStorm/PhpStorm'},
{value: 4, text: 'Komodo IDE'},
{value: 5, text: 'Other'}
];
jQuery("#select-1").on("click", function() {
bootbox.prompt({
title: "What's your IDE",
inputType:...