【发布时间】:2015-07-05 16:42:21
【问题描述】:
我正在尝试从 localStorage 取回值; div 元素中的多个点击计数器。 它们存储在 localStorage 中的 key = this.id 下单击;这些值是 div 的 innerText。
现在:1. 我过滤选择以查找 arraylocal 中元素 ID 的匹配项 2.如果匹配,设置html。
d3.selectAll(".numberCircle").filter((d) -> this.id in arraylocal).html(localStorage.getItem(((d) -> this.id))
我想使用“this.id”从 localStorage 中取回值(来自元素的 innerText)。
如何设置 localStorage.getItem(x????x) 以读取正确的键/值对(其中 key = this.id)?
因此:对于每个数组过滤器匹配,我还需要与该匹配相关的 localStorage 值。
【问题讨论】:
标签: javascript html d3.js local-storage