【发布时间】:2018-05-04 14:47:17
【问题描述】:
我想知道是否可以将对象推送到数组中,如果 id data-seats 已经存在,请在下次单击时替换/覆盖该值。
代码:
var active_filters = [];
$("a").on('click', function() {
active_filters.push({id: "data-seats", value: increment_value });
});
【问题讨论】:
-
是的,这是可能的!到目前为止,您尝试过什么?
-
到目前为止,我已经将对象推送到数组中:)
-
但是让它工作不是你的问题,对吧?
-
几乎是 stackoverflow.com/questions/28961994/… 的副本(以及其他几个喜欢它的人)。
标签: javascript jquery arrays