listen to check event on checkbox

http://stackoverflow.com/questions/10729060/knockout-js-and-listen-to-check-event-on-checkbox

HTML

<script src="http://knockoutjs.com/downloads/knockout-2.1.0.js"></script>
        <div>
            <input type="checkbox" data-bind="checked: PreviousSurnames().length > 0, click: $root.PreviousSurnames_Click" />Previous Surname(s)?
        </div>
        <div data-bind="foreach: PreviousSurnames">
            <div>
                <input type="text" data-bind="value: $data">
                <span data-bind="click: $root.removePreviousSurname">Remove</span>
            </div> 
        </div>

JavaScript

var myViewModelExample = function () {
        var self = this;

        self.PreviousSurnames = ko.observableArray(['SURNAME1', 'SURNAME2', 'SURNAME3']);

        self.removePreviousSurname = function (surname) {
            self.PreviousSurnames.remove(surname);
        };

        self.PreviousSurnames_Click = function () {
            if (self.PreviousSurnames().length === 0) {
                self.PreviousSurnames.push('');
            }
            else {
                self.PreviousSurnames.removeAll();
            }
            alet(2)
        }

    }

    ko.applyBindings(new myViewModelExample());