Consider the following HTML:
var max =0; $('.a').each(function(){ if(parseFloat($(this).attr('x'))>max) { max = parseFloat($(this).attr('x')) ; } }); alert(max);