I am attempting to store an array in the HTML data tag. For example:
If you use valid JSON ([ and ] for the array, double quotes instead of single), like this:
[
]
Then what you have (using .data()) to get the array will work: $('#locations').data('locations'); You can test it here. 0 讨论(0) 查看其它3个回答 发布评论: 提交评论 加载中... 验证码 看不清? 提交回复
Then what you have (using .data()) to get the array will work:
$('#locations').data('locations');
You can test it here.