在对象数组收到必要的输入并已提交显示后,我试图在 div 上设置刷新。到目前为止,我已经这样做了:
var users = [
{name: "John Smith", description: "Some chap", image: "None"},
{name: "Elizabeth II", description: "A fancy lass", image: "None"}
];
function arrayAdd() {
var title_text = $("#title_text").val();
var description_text = $("#description_text").val();
var image_text = $("#image_text").val();
users.push({name:title_text,description:description_text,image:image_text});
console.log(users);
for (var i = 0; i <= users.length; i++) {
$("#users").html(users[i]['name']);
};
}
但这仅显示了最后的附加值,你能告诉我一个解决这个问题的方法吗?