I would suggest changing this line:
               this.id = $.generateId();
...to:
               this.id = this.id || $.generateId();
... in order to avoid reassigning an ID to elements which have already received one.

On 9/27/06, Mark Gibson <[EMAIL PROTECTED]> wrote:
Hi,
Sometimes, I find it necessary to generate an id for an element,
so I created the following little plugin.
I'm posting it here in case it may be of use to anyone else,
and as a possible candidate for jQuery core.


$.generateId = function() {
        return arguments.callee.prefix + arguments.callee.count++;
};
$.generateId.prefix = 'jq$';
$.generateId.count = 0;

$.fn.generateId = function() {
        return this.each(function() {
                this.id = $.generateId();
        });
};


Regards
- Mark Gibson

_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/

_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/

Reply via email to