[jQuery] Re: creating unique IDs

2008-12-13 Thread brian
I just came across a *much* better way to do this in Andris Valums' ajax_upload plugin: var get_uid = function(){ var uid = 0; return function(){ return uid++; } }(); That's what's called a "closure", btw. http://valums.com/

[jQuery] Re: creating unique IDs

2008-12-09 Thread brian
That's an idea, thanks. In the end, though, I decided to rewrite this so that the div in question is shared between the other elements. So, I can use an ID. However, I've also since ditched DOMWindow because I need callback support. On Tue, Dec 9, 2008 at 4:20 PM, MorningZ <[EMAIL PROTECTED]> wr

[jQuery] Re: creating unique IDs

2008-12-09 Thread MorningZ
Why not just define a global variable, like var divID = 0; and use that when assigning the ID, while incrementing the value for the next.. So a super quick example http://paste.pocoo.org/show/94617/ On Dec 9, 3:51 pm, brian <[EMAIL PROTECTED]> wrote: > or: DOMWindow -- open with sel