Thanks , great solution. i figured out on on my own that is quite different. i don't know which is the best i terms of performance. i create an array "numbArray" first of the elements then i do this.
var index= $.inArray(0, numbArray); if(index== -1) { //Value not found in the array. } else { numbArray.splice(index,1); } var ithis = Math.min.apply(Math, numbArray); Thanks for your solution. Happy new year. On Jan 1, 7:45 pm, Šime Vidas <sime.vi...@gmail.com> wrote: > This shoud do the job... > > $("tr." + i).each(function() { > var ithis = $(this).find("td:lt(3)").map(function() { > if ($(this).html() === "0") { > return null; > } else { > return this; > } > }).min(); > $(this).find("td.r1").empty().append(roundVal(ithis)); > > }); > > so, you select the first 3 cells, and then do the map function, which > is similar to each... for every selected cell, if its content is "0", > then "deselect" it... so after the map function, you only have those > cells that doesn't contain "0", on them you run min()....