javascript中有一个对象数组。我需要在该数组中查找该对象的属性值。我需要将所有具有匹配属性的对象放在另一个数组中。我是 jquery 的初学者,任何帮助将不胜感激。谢谢。
var numPerRow = 6;
for (var i=0; i<subjects.length; i+=numPerRow) {
// TODO: Implement a row view
var printTitle = subjects[i].getTitle();
if (printTitle.indexOf(searchValue) > -1)
{
var row = $('<div class="browse-printables-row"></div>');
for (var j=0; j<numPerRow; j++) {
var idx = i+j;
if (idx >= subjects.length) {
break;
}
// TODO: Implement a printables tile view
row.append($(
'<div class="printable-tile">' +
'<img src=' + printTitle[idx].getIconURL() + ' class="subject-tile-icon"></img>' +
'<div class="subject-tile-title">' + printTitle[idx].getTitle() + '</div>' +
'</div>'
));
}
}
grid.append(row);