JSFiddle - React, Tailwind, and code Playground
HTML
<script src="https://code.jquery.com/jquery-1.11.3.min.js"></script>
<ul data-bind="foreach: items">
<li>
<a href="#" data-bind="click: $root.clickedAnchor">
<input type="checkbox" data-bind="checked: active" />
<span data-bind="text: name"></span>
</a>
</li>
</ul>
<ol data-bind="foreach: log">
<li data-bind="text: $data"></li>
<ol>
JavaScript
/**
* Defines the main ViewModel
* @returns {ViewModel}
*/
var ViewModel = function() {
var self = this;
self.items = ko.observableArray([
{name: "Test 1", active: true},
{name: "Test 2", active: false}
]);
self.log = ko.observableArray([]);
self.clickedAnchor = function(){
self.log.push(new Date().toDateString() + ': outer click worked...');
};
};
$(document).ready(function() {
ko.applyBindings(new ViewModel());
});