5
rated 0 times
[
9]
[
4]
/ answers: 1 / hits: 19267
/ 10 Years ago, thu, march 27, 2014, 12:00:00
I can't get the enable binding to work in Knockout JS. With the enabled property set to false, the button is not disabled and I can still click it.
see fiddle
<a class=btn btn-xl btn-primary
href=#
role=button
data-bind=enable: enabled, click: clicked, visible: isVisible>
<i class=icon-only icon-ok bigger-130></i>
</a>
var ViewModel = function(){
var self = this;
self.enabled = ko.observable(false);
self.isVisible = ko.observable(true);
self.clicked = function(){
alert('You clicked the button');
};
};
$(function(){
var model = new ViewModel();
ko.applyBindings(model);
})
More From » jquery