Confirm bootstrap e jquery
This is a simple Bootstrap skeleton. You can fork it to get a ready to use Bootstrap fiddle.
by edgardleal
HTML
<script src="http://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/2.1.0/bootstrap.min.js"></script>
<div class="panel panel-default">
<div class="panel-heading">
<div class="panel-title">
Painel
</div>
</div>
<div class="panel-body">
<form action="" class="form form-default" method="POST">
</form>
</div>
<div class="panel-footer">
</div>
</div>
CSS
@import url('http://getbootstrap.com/dist/css/bootstrap.css');
JavaScript
function log(text){
$('.panel-footer').text(text);
}
Alert = {
$dialog : undefined,
callBack : null,
start : function(){
if(this.$dialog ) return;
var html = '<div class="modal fade"> ' +
' <div class="modal-dialog"> ' +
' <div class="modal-content"> ' +
' <div class="modal-header"> ' +
' <button type="button" class="close" ' +
' data-dismiss="modal" aria-hidden="true">×</button> ' +
' <h4 class="modal-title">Painel 360</h4> ' +
' </div> ' +
' <div class="modal-body"> ' +
' <p>One fine body…</p> ' +
' </div>' +
' <div class="modal-footer">' +
' <button type="button" class="btn btn-default" data-dismiss="modal">Cancelar</button>' +
' <button type="button" ' +
' class="btn btn-primary" id="ok">Confirmar</button>' +
' </div></div></div></div>';
this.$dialog = $(html);
this.$dialog.appendTo($('body'));
var self = this;
this.$dialog.find('#ok').click(function(){
self.$dialog.modal('toggle');
self.runCallBack();
});
},
runCallBack : function(){
if(this.callBack &&
typeof this.callBack === "function")
this.callBack.call();
},
confirm : function(message, callBack){
this.start();
this.callBack = callBack;
this.$dialog.find('.modal-body').html(message);
this.$dialog.modal();
}
};
Alert.confirm('Confirma a exclusão do registro?',
function(){
alert('Exclusão confirmada!');
});