JSFiddle - React, Tailwind, and code Playground
HTML
<script src="//ajax.googleapis.com/ajax/libs/jquery/2.0.2/jquery.min.js"></script>
<div data-bind="foreach:comments">
<input type="button" data-bind="click: editComment,value:editable() ? 'Save' : 'Edit comment' " />
<button data-bind="">Delete</button>
</div>
JavaScript
$(document).ready(function () {
vm=function ViewModel(){
var self = this;
self.comments = ko.observableArray();
function Comment() {
var self=this;
self.editable = ko.observable(false);
self.editComment = function () {
self.editable(!self.editable());
};
};
self.comments.push(new Comment());
};
ko.applyBindings(new vm);
});