I'm trying to disable the backdrop from closing the modal when clicked with the following:
ko.bindingHandlers.showModal = {
init: function (element, valueAccessor) {
},
update: function (element, valueAccessor) {
var value = valueAccessor();
if (ko.utils.unwrapObservable(value)) {
$(element).modal({ backdrop: 'static', keyboard: true });
// this is to focus input field inside dialog
$("input", element).focus();
}
else {
$(element).modal('hide');
}
}
};
From what I understand, $(element).modal({ backdrop: 'static', keyboard: true });
should achieve what I'm after. But if I click on the backdrop the modal still closes though, and in fact breaks the "show" button. What am I doing wrong here?
Fiddle: http://jsfiddle.net/PTSkR/175/