Well its for a chat box and I want to remove old messages as new messages come in, so that there are 20 messages being shown at any one time, using = works perfectly if you add 1 new message because it selects the last message ID and subtracts 20, but if you add 2 messages then the first message will stay and the second message will disappear. Source code: http://www.forsakenrealms.co.cc/chat/?user=test
On Aug 31, 11:01 pm, "Michael Geary" <m...@mg.to> wrote: > Can you give us a hint what your DOM elements look like? For example, are > these ID attributes in ascending order in the DOM? That would allow you to > use a very fast binary search. If they are in an undetermined order then > you're pretty much stuck with looping through them - but with thousands of > them I would use a for loop rather than .each(). > > Or as Josh suggested, do something on the server. But it's hard to make any > recommendations without knowing more about what you're doing. > > -Mike > > > > > From:Namir > > > Still how would I do it with an each? I'd still need to > > select all the ones with an attribute of less than x, and it > > would be stupid to loop it from 1 to whatever as x can reach > > thousands. Do you have any other suggestions as to how I > > could do this? > > > On Aug 31, 9:58 pm, aquaone <aqua...@gmail.com> wrote: > > > id will be a string. AFAIK there's no built-in to parse it > > as a number > > > and compare. you'd either have to .each() it or find > > another means of > > > accomplishing what you are trying to do. > > > > aquaone > > > > On Mon, Aug 31, 2009 at 13:50,Namir<namiras...@hotmail.com> wrote: > > > > > How can I do a less than in a select e.g. something like > > > > $.("span.class [id<"+ a_custom_variable +"]") when I > > tried that it > > > > just selected all span of class with an ID attribute rather than > > > > where ID attribute is less than