I tried the click binding, but its not working

64 views
Skip to first unread message

Nirmal Kumar.A

unread,
Apr 13, 2018, 3:14:00 AM4/13/18
to KnockoutJS
I tried the example code provided on this page for click binding.


But, it did not work. I tested this code here.


I have attached a screenshot of the output that I got. Could anyone help me with this?
screenshot.png

John Olson

unread,
Apr 13, 2018, 1:05:06 PM4/13/18
to KnockoutJS
First, you need to apply the bindings either in a <script> tag within the HTML document or at the bottom of the javaScript file. 

ko.applyBindings(viewModel);

Also, it's unnecessary to create the previous count variable. You can simply increment it within the observable parameters.

Reply all
Reply to author
Forward
0 new messages