Store and use an array using the HTML data tag and jQuery

后端 未结 3 2079
一生所求
一生所求 2020-12-05 02:07

I am attempting to store an array in the HTML data tag. For example:

3条回答
  •  暗喜
    暗喜 (楼主)
    2020-12-05 02:56

    Try this:

    var testOne = eval("new Array(" + $('#locations').data('locations') + ")");
    

    Look at it in jsfiddle.

提交回复
热议问题