我想使用原型(prototype)读取 HTML td 的值。例如,假设您有如下表格
<table id="myTable">
<tr>
<td>apple</td>
<td>orange</td>
</tr>
<tr>
<td>car</td>
<td>bus</td>
</tr>
</table>
我想单独读取值 - apple、orange、car 和 bus。我找不到 怎么做?任何帮助都会有很大帮助。
谢谢, J
最佳答案
这应该有效:
var values = $$('#myTable td').collect(function(element) {
// stripTags(), if you're only interested in the actual content
return element.innerHTML.stripTags();
});
关于html - 使用原型(prototype)读取 td 值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4333894/