How to pass an array into jQuery .data() attribute

前端 未结 4 2039
野的像风
野的像风 2020-12-13 03:39

Ok so I want to pass a very basic array into a jquery data attrubute server side like so:

<
4条回答
  •  被撕碎了的回忆
    2020-12-13 03:54

    A different approach is posted at jsfiddle; var stuff = $('div').data('stuff'); stuff is a string with 0th character as '['

    Well, var stuff = eval($('div').data('stuff')); should get you an array

提交回复
热议问题