I have problem with modal in my code, there is not appear and div with class "modal-backdrop fade in" is empty.
<body>
<button type="button" title="Usuń" class="deleteButton btn btn-default btn-xs pull-right">Usuń</button>
<div id="confirm" class="modal hide fade">
<div class="modal-body">
Are you sure?
</div>
<div class="modal-footer">
<button type="button" data-dismiss="modal" class="btn btn-primary" id="delete">Delete</button>
<button type="button" data-dismiss="modal" class="btn">Cancel</button>
</div>
$("body").on('click', "button.deleteButton", function (e) {
var clickedButton = $(this);
e.preventDefault();
$('#confirm').modal({ backdrop: 'static', keyboard: false })
.one('click', '#delete', function () {
clickedButton.attr("disabled", true);
});
});
Here is my fiddle: https://jsfiddle.net/cjdtzsha/
What can be reason for it?
Remove hide
class from <div id="confirm" class="modal hide fade">
it has important
rule on display:none
property not letting the modal show.
Now add <div class="modal-content"></div>
and enclose modal-header
and modal-footer
inside it
<div id="confirm" class="modal fade">
<div class="modal-content">
<div class="modal-body">
Are you sure?
</div>
<div class="modal-footer">
<button type="button" data-dismiss="modal" class="btn btn-primary" id="delete">Delete</button>
<button type="button" data-dismiss="modal" class="btn">Cancel</button>
</div>
</div>
</div>
Fix all issues.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.