JSFiddle - React, Tailwind, and code Playground
by Aaron Zhang
HTML
<table id="result"></table>
<table cellspacing="0" class="data" id="attributeGrid_table" style="display:none">
<tbody id="anchor">
<tr title="https://beta.wireless1.com.au/index.php/admin/catalog_product_attribute/edit/attribute_id/1124/key/5a1741e508e5e551539be38fa9d1fd53/" class="even pointer">
<td class=" ">accessory_type</td>
<td class=" ">Accessory Type</td>
<td class="a-center ">No</td>
<td class="a-center ">No</td>
<td class="a-center ">Yes</td>
<td class="a-center ">Store View</td>
<td class="a-center ">Yes</td>
<td class="a-center ">No</td>
<td class="a-center last">Yes</td>
</tr>
<tr title="https://beta.wireless1.com.au/index.php/admin/catalog_product_attribute/edit/attribute_id/1158/key/5a1741e508e5e551539be38fa9d1fd53/" class="pointer">
<td class=" ">amrolepermissions_owner</td>
<td class=" ">Product Owner</td>
<td class="a-center ">No</td>
<td class="a-center ">No</td>
<td class="a-center ">No</td>
<td class="a-center ">Global</td>
<td class="a-center ">No</td>
<td class="a-center ">No</td>
<td class="a-center last">No</td>
</tr>
<tr title="https://beta.wireless1.com.au/index.php/admin/catalog_product_attribute/edit/attribute_id/1015/key/5a1741e508e5e551539be38fa9d1fd53/" class="even">
<td class=" ">aw_os_category_display</td>
<td class=" ">Display label on category page</td>
<td class="a-center ">Yes</td>
<td class="a-center ">Yes</td>
<td class="a-center ">No</td>
<td class="a-center ">Store View</td>
<td class="a-center ">No</td>
<td class="a-center ">No</td>
<td class="a-center last">No</td>
</tr>
<tr...
JavaScript
$(document).ready(function () {
var result = {};
var visibility = {};
$('#anchor').children('tr').each(function () {
var $this = $(this);
var $tds = $this.children('td');
result[$.trim($($tds[0]).text())] = $.trim($($tds[1]).text());
visibility[$.trim($($tds[0]).text())] = $.trim($($tds[4]).text()).toLowerCase() == 'yes' ? true : false;
});
var table = ['features',
'warranty',
'gidentifier_exists',
'gproducttype',
'mproducttype',
'dimensions',
'display_weight',
'groupdeal_fineprint',
'groupdeal_highlights',
'groupdeal_type',
'groupdeal_status',
'mpn',
'operation_system',
'cpu_model',
'phonetab_cpu',
'os_platform',
'mobile_networks',
'network_lock',
'network_branding',
'sim_type',
'display',
'phone_screen',
'memory',
'internal_storage',
'handset_type',
'computer_cam',
'phone_camera',
'bluetooth',
'card_slot',
'battery',
'color',
'nw_product_type',
'nw_wireless',
'nw_ethernet',
'nw_freqband',
'nw_security',
'nw_advanced',
'tablet_connectivity'];
$.each(table, function (k, v) {
if (visibility[v]) {
$('table#result').append('<tr><td>' + result[v] + '</td><td>#' + v + '#</td></tr>');
}
});
});