• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

jquery chaining

 
Ranch Hand
Posts: 79
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I've read somewhere that chaining in jquery is slow - when overused.
What is the alternative - a variable?
What if this isn't in loop (I guess a variable wouldn't help then)?

Thanks in advance, always warlmy, Gregor
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Reading something somewhere doesn't make something true.

jQuery can be inefficient if used incorrectly regardless of using chaining. Do you have specific instances where you have a jQuery chain that is performing poorly?

P.S. Using intermediary variables will not help poorly performing selectors; but yes, as with any other operation you don't want to perform it needlessly in a loop. That's really a principle that is larger than jQuery or chaining.
 
reply
    Bookmark Topic Watch Topic
  • New Topic