1

I read this great thread: What are queues in jQuery?

Now it makes me wonder:

Does it matter which DOM object you bind queue to?

i.e. $('div').queue(); vs. $('body').queue({}) or even $('.foo').queue();

Community
  • 1
  • 1
chrisjlee
  • 21,691
  • 27
  • 82
  • 112
  • @david Thanks for the fix. i'll try to do that next time – chrisjlee Nov 16 '10 at 15:29
  • no worries, the community is built to be self-correcting in this manner. I habitually add code-markup when I see it's missing, because when it's not there, there may often be HTML code (say) in the question that is not showing because the tags are not escaped. – David Hedlund Nov 16 '10 at 15:34

1 Answers1

1

Each element has its own queue.

Calling $('.foo').queue(); will queue the function on every .foo element.

SLaks
  • 868,454
  • 176
  • 1,908
  • 1,964
  • Which would be better practice? Or that is decided on context. – chrisjlee Nov 16 '10 at 15:26
  • @Chris: It depends. If you're working on a specific element, you should use its queue. Otherwise, you should use whatever you want. – SLaks Nov 16 '10 at 15:26