我有这张桌子:
<table id="tblNyttUtstyr">
<thead>
<tr>
<th data-field="UtlevertUtstyrID">UtstyrsID</th>
<th data-field="UtstyrNavn">Navn</th>
<th data-field="Utlevert">Utlevert</th>
<th data-field="Comment">Kommentar</th>
</tr>
</thead>
<tbody>
<tr>
<td>1</td>
<td>Motorola defy+</td>
<td>true</td>
</tr>
<tr>
<td>3</td>
<td>Samsung SII</td>
<td>true</td>
</tr>
</tbody>
</table>
然后我有这个脚本
var test = $("#tblNyttUtstyr tbody tr").map(function () {
var $row = $(this);
return {
UtlevertUtstyrID: $row.find(":nth-child(1)").text(),
Comment: $row.find(":nth-child(2)").text()
};
}).get();
$("#console").text("content: " + test);
返回值是这样的:“内容:[object],[object]”
任何人都知道如何获取值,文本而不仅仅是对象
谢谢