I have a set of element that has some data attributes. I am able to load single data attributes to an array of array dataAraay but on data-size which is like group of arrays in string format I don't know how to load them into the dataArray to exactly looks like
dataArray = [
["1","true","X1","48","14","139", "android"],
["1","true","X1","49","15","135","51","15","140","ios"],
["1","true","X1","49","800","135","51","200","140","52","14","141" "windows"]
]
How can I fix this?
let dataArray = [];
$(".data").each(function(){
dataArray.push([ $(this).data('number'),
$(this).data('avaiable'),
$(this).data('brand'),
// I have issue here on loading the zies into each array
$(this).data('app')
]);
});
console.log(dataArray);
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<div class="data" data-number="1" data-avaiable="true" data-brand="X1" data-size="[48, 14,139]" data-app="android" ></div>
<div class="data" data-number="3" data-avaiable="false" data-brand="M200" data-size="[49,15,135],[51,15,140]" data-app="ios" ></div>
<div class="data" data-number="5" data-avaiable="true" data-brand="T500" data-size="[49,800,135],[51,200,140],[52,16,141]" data-app="windows" ></div>