Knockout js for attribute binding in IE8

孤人 提交于 2019-12-25 04:22:01

问题


Can't bind for attribute in IE8

http://jsfiddle.net/k2Mq7/ - ko 2.1:

SCRIPT5022: Unable to parse bindings.
Message: SyntaxError: Expected identifier, string or number;
Bindings value: attr: { id: 'that-works', for: 'but-than-not' } 

http://jsfiddle.net/k2Mq7/3/ - ko 2.1 quoted for ('for'):

jsfiddle fails but on my local machine no any errors but this label displayed without for attribute.

Is it Knockoutjs bug or that I am doing something wrong?


回答1:


Use quotation marks for attributes names like this:

<label data-bind="attr: { 'for': vmProperty }"></label>


来源:https://stackoverflow.com/questions/21937632/knockout-js-for-attribute-binding-in-ie8

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!