The problem happened because I was trying to bind a HTML element before it was created.
My script was loaded on top of the HTML and it needs to be loaded at the bottom of my HTML code.
Thanks for your attention James Allardice.
A possible workaround is using defer="defer"
<script src="script.js" type="text/javascript" defer="defer"></script>
Use this if the script is not going to generate any document content. This will tell the browser that it can wait for the content to be load before loading the script.
Hope it helps.

本文解决了KnockoutJS与第三方UI插件EasyUI的dataGrid绑定问题,介绍了导致错误的原因及两种解决方法:调整脚本加载位置或使用defer属性。



8万+





