JSFiddle - React, Tailwind, and code Playground

by bluey

HTML

<table>
    <tr id="till__tablepanel_table_0_row_3" class="till__tablepanel_table_0_row__ticket"
    data-rowunitprice="1.00" data-row_total="1.00" data-row_quantity="1"
    data-measure_type_is_grams="0" data-itemtitle="tea" data-ticket_row_num="3">
      <td>3</td>

      <td>tea</td>

      <td><span id="till__tablepanel_table_0_row_3_quant" class=
      "wrap quantity">1</span></td>

      <td>&pound;1.00</td>

      <td>&pound;<span id="till__tablepanel_table_0_row_3_totalprice" class=
      "till__tablepanel_table_0_row__totalprice">1.00</span></td>
    </tr>
     
         <tr id="till__tablepanel_table_0_row_3" class="till__tablepanel_table_0_row__ticket"
    data-rowunitprice="1.00" data-row_total="1.00" data-row_quantity="1"
    data-measure_type_is_grams="0" data-itemtitle="tea" data-ticket_row_num="3">
      <td>3</td>

      <td>tea</td>

      <td><span id="till__tablepanel_table_0_row_3_quant" class=
      "wrap quantity">1</span></td>

      <td>&pound;1.00</td>

      <td>&pound;<span id="till__tablepanel_table_0_row_3_totalprice" class=
      "till__tablepanel_table_0_row__totalprice">1.00</span></td>
    </tr>
     
         <tr id="till__tablepanel_table_0_row_3" class="till__tablepanel_table_0_row__ticket"
    data-rowunitprice="1.00" data-row_total="1.00" data-row_quantity="1"
    data-measure_type_is_grams="0" data-itemtitle="tea" data-ticket_row_num="3">
      <td>3</td>

      <td>tea</td>

      <td><span id="till__tablepanel_table_0_row_3_quant" class=
      "wrap quantity">1</span></td>

      <td>&pound;1.00</td>

      <td>&pound;<span id="till__tablepanel_table_0_row_3_totalprice" class=
      "till__tablepanel_table_0_row__totalprice">1.00</span></td>
    </tr>
     
  </table>

JavaScript

var multi = $('.till__tablepanel_table_0_row__ticket');
var myarray = [];

$.each(multi, function (index, item) {
    myarray.push( {name: 'ticket_row_num', value: $(item).data('ticket_row_num')} ); 
    myarray.push( {name: 'itemtitle', value: $(item).data('itemtitle')} );
    myarray.push( {name: 'row_quantity', value: $(item).data('row_quantity')} ); 
    myarray.push( {name: 'rowunitprice', value: $(item).data('rowunitprice')} );  
    myarray.push( {name: 'row_total', value: $(item).data('row_total')} ); 
   
  //  myarray.push( {name: 'measure_type_is_grams', value: $(item).data('measure_type_is_grams')} ); 
   
});

alert(myarray);