是否可以在敲除绑定声明中使用jquery?例如,我试图通过单击“全部”复选框来选择一组复选框。这就是我试图声明点击绑定的方式:
selectAll.bind($parent, $(this).is('checked'))
但这似乎不起作用。我在Chrome中遇到以下异常:
Uncaught Error: Unable to parse bindings.
Message: TypeError: Cannot call method 'toLowerCase' of undefined;
Bindings value: click: $parent.selectAllFacets.bind($parent, $(this).is('checked'))
这可能吗?提前谢谢。
答案 0 :(得分:1)
JFTR,使用“jQuery”而不是“$”。具体来说,对于上面的例子:
function(data, event) {selectAll($parent, jQuery(event.target).is(':checked'))}
我无法使用“bind”使其工作,但这个答案应该是更多跨浏览器兼容。
希望它有所帮助。