Knockoutjs.com - Hello World Example
http://knockoutjs.com/examples/helloWorld.html
HTML
<script src="http://knockoutjs.com/downloads/knockout-3.2.0.js"></script>
<script src="https://code.jquery.com/jquery-3.0.0.min.js" integrity="sha256-JmvOoLtYsmqlsWxa7mDSLMwa6dZ9rrIdtrrVYRnDRH0="></script>
EnableMe: <input id="myradio1" type="radio" data-bind='checked: enableMe'/><br/>
Enable status: <span data-bind='text: enableMe'></span>
<br/>
<button id="button1" onclick="clickme();">Click To Disable</button>
JavaScript
var ViewModel = function() {
this.enableMe = ko.observable(false);
};
var myVM = new ViewModel();
ko.applyBindings(myVM);
function clickme() {
//Changing the checked state does not change VM
document.getElementById("myradio1").checked = true;
//Changing the VM works
//myVM.name("Updated name");
//myVM.enableMe(true);
alert("Alert Message OnClick");
}