Here we go, I made a JSFiddle with what you're looking for.
Made use of the .filter()
function and applied a .hide()
to all that don't match the top tier.
var min = 0;
$(".medical-list li").filter( function(k, v) {
if( k < 3 ) { //Top 3 will be shown
min = parseInt($(v).data('sortm'));
return false;
} else //Anything else must equal to third one, or it's filtered
return min > parseInt($(v).data('sortm'));
}).hide(); //Hide all that are not in the top 3
Of course, you would place this after your li
's are sorted.