【发布时间】:2012-08-28 11:10:54
【问题描述】:
我有一个像这样的<td> 元素:
<td class="right editable qty">100</td>
我想获取其中的值 (100),但遇到了一些问题。
这是我的脚本:
$('#example tbody tr td.qty').change(function () {
var sQty = $(this);
console.log(sQty); // print [<td class="right editable qty">100</td>]
console.log($.text(sQty)); // print nothing
console.log(sQty.val()); // print nothing
console.log(sQty.text()); // print nothing
console.log(sQty.html()); // print <form><input style="width: 100%; height: 100%; " autocomplete="off" name="value"></form>
});
我的脚本有什么遗漏吗?
我正在使用:DataTables 和 jeditable
【问题讨论】:
-
TD 元素不会触发 change 事件。您可以使用单击。
-
@undefined:更新了问题。
-
可以使用点击方式。 jsfiddle.net/RJCxt/3
标签: jquery html datatables jeditable