How to sort rows using jquery. My aim is to just find the item with min price. Not actually sort the table.
This below code always shows the first row which is not actually right.
var rows = $('tr');
rows.sort(function(a, b){
var p1 = parseInt(a.querySelector('td.item') ? a.querySelector('td.item').innerText : 0)
var p2 = parseInt(b.querySelector('td.item') ? b.querySelector('td.item').innerText : 0);
return p1 > p2;
});
console.log(rows[0])