I have a class .object which has an attribute called level. I want to get a list of all the different values of level on the page so I
You can extend the functionality of Jquery and add your own 'attrs' implementation.
Add the following lines of code to your JavaScript file:
jQuery.fn.extend({
attrs: function (attributeName) {
var results = [];
$.each(this, function (i, item) {
results.push(item.getAttribute(attributeName));
});
return results;
}
});
Now you can get the list of level values by calling:
$(".object").attrs("level")