JSFiddle - React, Tailwind, and code Playground
by nickkell
HTML
<script src="http://cloud.github.com/downloads/SteveSanderson/knockout/knockout-2.0.0.debug.js"></script>
<p data-bind="text: hasNext"></p>
<input type="button" data-bind="enable: hasPrevious" value="previous"/>
<input type="button" data-bind="enable: hasNext" value="next"/>
JavaScript
function Wizard() {
self.steps = ko.observableArray([
'step1','step2','step3'
]);
var currentStep = ko.observable(self.steps()[0]);
self.hasNext = ko.computed(function(){
return self.steps.indexOf(currentStep()) < self.steps().length;
});
self.hasPrevious = ko.computed(function(){
return self.steps.indexOf(currentStep()) > 0;
});
self.next = function(){
if(self.hasNext()){
}
};
}
ko.applyBindings(new Wizard());