Make sure to apply your own class
to the dialog's buttons:
$("#dialog").dialog({
buttons: [{
text: 'Ok',
class: 'ok-button'
}]
});
Grab the button.ok-button
and apply a data-bind
attribute to it (visible
here, just to show you that it works). Here, name
is an observable property of our view model:
$("button.ok-button").attr("data-bind", "visible: name().length");
Apply bindings normally:
var model = { name: ko.observable('') };
ko.applyBindings(model);
Here's an example that hide's an "Ok" button on the dialog if name
(an observable) has a length > 0
:http://jsfiddle.net/9cRFy/