0
您可以看看this demo並讓我知道如何在Js數組或對象中存儲(推送)檢查行的值?關於從行中的複選框獲取表值的問題
var obj=[
{
id : "001",
name : "apple",
category : "fruit",
color : "red"
},
{
id : "002",
name : "melon",
category : "fruit",
color : "green"
},
{
id : "003",
name : "banana",
category : "fruit",
color : "yellow"
}
]
$.each(obj, function (index, item) {
var eachrow = "<tr>"
+ "<td id="+index+"><input type='checkbox'></td>"
+ "<td>" + item["id"] + "</td>"
+ "<td>" + item["name"] + "</td>"
+ "<td>" + item["category"] + "</td>"
+ "<td>" + item["color"] + "</td>"
+ "</tr>";
$('#tbody').append(eachrow);
});
感謝