you could use $.data() to get a unique id, something like: $.extend($.fn, { id : function () { return this.each(function () { $(this).attr("id", "jQuery_" + $.data(this)); }); } });
example usage : $('<div /><div /><div />').id().appendTo('body'); result : <div id="jQuery_1"/><div id="jQuery_2"/><div id="jQuery_3"/> hope this helps :)