How to fix TypeError: c is null in KnockoutJS

How to fix TypeError: c is null in KnockoutJS:

When we run test the knockout js in firstime we may get error called TypeError: c is null. Due to these our sample program will get stoped.When this error may come: Below the script i placed & tested in a browser. Seems output is null & will get the error called
TypeError: c is null .

ko1

How to fix these issue:
We can fix these issue with below ways.
1. With Jquery we can fix the issue. We need to declare Jquery min file and we need to declare our KO-viewmodel inside the jquery ready function. As like below

ko2

2. Another way is the best practice to resolve these issue. This is with out Jquery library.We need to replace KO-ViewModel script to bottom of View section. As like below way.

Sample Code:ko3

CORNER OF BLOG:

“Avoid Plastic Save Nature”

Leave a Reply