November 22, 2016

TypeError: h.apply is not a function

This is a Knockout JS error. I faced this issue when I am trying to invoke click action of a link created. My link statement is like below.

<a data-bind="attr:{id:Reqid},text: Title,click: $('#popup1').ojPopup('open', '#btnTitle')"></a>

And on click of this link, I am getting the below error.

TypeError: h.apply is not a function

This is because the click handler needs to be wrapped within a function. Below updated statement resolved the issue.

<a data-bind="attr:{id:Reqid},text: Title,hover: function(){$('#popup1').ojPopup('open', '#btnTitle')}"></a>

No comments:

Post a Comment