【发布时间】:2013-04-25 20:06:22
【问题描述】:
如何将 javascript Array 存储在 HTML5 data 属性中?
我已经尝试了JSON.stringifycation 和转义字符的所有变体。
存储数组并再次检索它的精确方法是什么?
注意
我使用[ $("#firstSelectedElement").val(), $("#secondSelectedElement").val() ] 构建数组。我用$("#storageElement").data('storeit') 检索id="storageElement" data-storeIt="stuff"。
我似乎永远无法将数据检索为真正的Array,只能检索到Array 的字符。
【问题讨论】:
标签: javascript jquery arrays parsing html5-data