使用knockout.js突出显示表格行
我正在努力学习Knockout。 我想在单击行中的链接时突出显示表行。 我很难理解这个的背景,以及淘汰如何与JQuery
交互。 我可以像标准的jquery函数一样构建knockout函数吗?
Name Cat Size
然后我的视图模型……
function MyViewModel() { this.components = ko.observableArray(); this.selectedComponent = ko.observable(); this.highlightComponent = function(e) { console.log($(this).parents("tr")); $(this).closest("tr").siblings().removeClass("diffColor"); $(this).parents("tr").toggleClass("diffColor", e.clicked); } }