【发布时间】:2017-04-06 22:45:48
【问题描述】:
我有一个动态表:
<table>
<tbody>
<tr>
<td>1</td>
<td contenteditable='true'>Value1</td>
</tr>
<tr>
<td>2</td>
<td contenteditable='true'>Value2</td>
</tr>
</tbody>
</table>
我想在用户写完(blur)时获取可编辑单元格的值
$('table td').focus(function () {
console.log("focus ");
console.log("echo each input "); // show every carac inputed
});
$('table td').blur(function () {
console.log("blur ");
console.log("echo the new value"); // show the new value
});
所以我的问题是如何在 blur 事件中获得新值,以及如何准确地获得 td 的修改。
【问题讨论】:
标签: javascript jquery html html-table