Need to compare Knockout with jQuery?

Actual answer for above question is “NO”. Knockout.js is not a replacement of jQuery, Prototype etc.,. It doesn’t target to provide animation or AJAX functionality (Knockout.js can parse the data which received from an AJAX request). Knockout.js is focused only designed on data-driven UI. It is compatible with other client-side and  server-side technology.

Knockout.js uses a Model-View-ViewModel (MVVM) design pattern. In this, the model is react as data from back-end/business logic and the view is the visual representation of that data (UI) which is visible to the user and ViewModel acts as the intermediary between the model and the view.

In simple we can say the ViewModel is a JavaScript representation of the model data, along with associated functions for manipulating the data. Knockout.js creates a direct connection between the ViewModel and the view, which helps to detect changes from the mode and automatically update to the all the required changes in UI, in same way the update made in UI will automatically update to the model by the help of view model.

How to use Knockout ?

Simply reference to be made for the knockout file using a <script> tag in our your HTML pages. Let see below example,

<script type=’text/javascript’ src=’knockout-3.4.2.js’></script>