149
rated 0 times
[
151]
[
2]
/ answers: 1 / hits: 96658
/ 13 Years ago, fri, may 20, 2011, 12:00:00
I want to pass an array into a jQuery data attribute on the server side and then retrieve it like so:
var stuff = $('div').data('stuff');
alert(stuff[0]);
<script src=https://cdnjs.cloudflare.com/ajax/libs/jquery/1.6.1/jquery.min.js></script>
<div data-stuff=['a','b','c']></div>
Why does this appear to alert '[' and not 'a' (see JSFiddle link)
JSFiddle Link: http://jsfiddle.net/ktw4v/3/
More From » jquery