在按键上的表中添加新行会在内容可编辑div中添加额外的行

时间:2016-10-13 19:16:27

标签: javascript html angularjs javascript-events

我有一个function ([boolValue, stringValue]: [boolean, string]) { // make use of boolValue and stringValue } ,有三列。每行,第一列和第三列都是table字段,每行中的第二列是input div。

当用户在content editable div上并且按content editable时,它应该在其下方添加Enter Keynew row应该从当前{{1}转移转到focus的{​​{1}}。

问题出在content editable div按键上,在content editable div内添加了new rowEnter中的new row也加起来了。

这是plunkr:http://plnkr.co/edit/QxZC4bVgWOHJ65pM9F38?p=preview

1 个答案:

答案 0 :(得分:0)

app.js文件中的onKeyDown函数应为

override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
    print("You selected cell #\(indexPath.row)!")
}

注意$ event.preventDefault();线。