JSFiddle - React, Tailwind, and code Playground
by adrienne
HTML
<script src="http://cloud.github.com/downloads/SteveSanderson/knockout/knockout-2.0.0.js"></script>
<div data-bind="foreach: buttons">
<button data-bind="click: handler, text: text"></button>
</div>
<button data-bind="click: makeUI">Add a button</button>
JavaScript
var system = function()
{
var self = this;
this.hello = function(button)
{
alert("hello from " + button.text);
}
self.buttons = ko.observableArray([]);
this.makeUI = function(container)
{
self.buttons.push({
text: "button " + self.buttons().length,
handler: this.hello
});
}
}
ko.applyBindings(new system);