Referencing the current jQuery object in a chain?
Posted
by Lance McNearney
on Stack Overflow
See other posts from Stack Overflow
or by Lance McNearney
Published on 2010-04-15T17:30:43Z
Indexed on
2010/04/15
17:33 UTC
Read the original article
Hit count: 204
jQuery
At DevDays in SF last year (before jQuery 1.4 was released), I thought they mentioned an upcoming feature in 1.4 that would allow you to reference the current jQuery object while in a chain. I've read through all of the 1.4 improvements and wasn't able to find it. Does anyone know how this can be done?
Example
Being able to access the current jQuery object would be helpful when working with methods that are in relation to the current object like .next():
// Current way
var items = $(this).closest('tr');
items = items.add(items.next(':not([id])'));
// Magical 1.4 way? Is there a "chain"-like object?
var items = $(this).closest('tr')
.add(chain.next(':not([id])'));
© Stack Overflow or respective owner