繁体   English   中英

淘汰赛获得输入值

[英]Knockout get input value

我已经在网上搜索并尝试阅读该手册,但未能找到我的问题的答案

我有这个带有可剔除js的可编辑网格:

http://jsfiddle.net/peterf/8FMPc/light/

<input type="text" class="edit" data-bind="value: name.editValue, visible: $root.isItemEditing($data)"  />
<label class="read" data-bind="text: name, visible: !$root.isItemEditing($data)" />

我想做的是,在单击“添加新水果”按钮并插入“水果名称”之后,通过控制台从Web开发人员工具/代码获取插入的值。

英语不是我的母语。 请原谅输入错误。

这是您要找的东西吗?

http://jsfiddle.net/8FMPc/305/

self.applyFruit = function (fruit) {
        //  commit the edit transaction
        self.editTransaction.notifySubscribers(null, "commit");
        console.log(fruit.name());
        //  hides the edit fields
        self.editingItem(null);
    };

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM