I think that if you really want and need this function to save time, I would just add it as a new method. Sort of:
$.fn.extend({ id: function(){return this.attr('id');} }); $('.test').id();
But I will repeat the same concern that James Westgate said, if you have several returns to the collection, you need to make sure that you handle it properly, otherwise you may break the material.
source share