knockoutjs jquery mobile checkbox list issue
With knockoutjs and jquery mobile, I need to create a list of checkboxes from an array. It seems the checkbox list is rendered, but it did not respond to click.
HTML
<link rel="stylesheet" href="http://code.jquery.com/mobile/1.1.0/jquery.mobile-1.1.0.min.css">
<script src="http://code.jquery.com/jquery-1.7.1.min.js"></script>
<script src="http://code.jquery.com/mobile/1.1.0/jquery.mobile-1.1.0.min.js"></script>
<script src="https://github.com/downloads/SteveSanderson/knockout/knockout-2.0.0.js"></script>
<label class="checkbox no-margin no-padding inline-block">
<input type="checkbox" />Show All
</label>
<label class="checkbox no-margin no-padding inline-block">
<input type="checkbox" data-bind="checked: myCheck" />Click me
</label>
JavaScript
var VM = function () {
var self = this;
self.myCheck = ko.observable(false);
self.myCheck.subscribe(function(){
alert(self.myCheck());
});
}
ko.applyBindings(new VM());