$(".object").attr("level") will just return the attribute of first the first .object element.
This will get you an array of all levels:
var list = $(".object").map(function(){return $(this).attr("level");}).get();
$(".object").attr("level") will just return the attribute of first the first .object element.
This will get you an array of all levels:
var list = $(".object").map(function(){return $(this).attr("level");}).get();