I have a bunch of elements like:
..
I want to loop through all of them and get the highest
I would do:
var max = 0; $(".blah").each(function(){ num = parseInt(this.id.split("-")[1],10); if(num > max) { max = num; } });
Most people would do this way.