Realized version of the script by David Ferog.
function sortByRationalValue (a,b){ return a.rationalValue - b.rationalValue; } function returnObjectFromMeasurements(element, text) { var obj = {}, range = text.replace(/["'"″]/g, '').split('-'), rational; if (range.length > 1) rational = eval(range[0]) + eval(range[1]); else rational = eval(range[0]); obj.rationalValue = rational; obj.element = element; return obj; } (function run(){ var tableVars = [], tableElements = []; var $tr = $("table#trg tr.trg-variations"); $tr.each(function (index) { var $this = $(this); tableVars[index] = returnObjectFromMeasurements(this, $this.children('td').first().text() ); }); tableVars.sort(sortByRationalValue); $.each(tableVars, function (index, value) { tableElements[index] = value.element; }); $('#trg tbody').html(tableElements).find('tr:odd').addClass('odd'); }());
source share