[jQuery] Re: How to use context and reference it inside a jquery object

2008-09-18 Thread Ariel Barreiro
Right, I kind of figured the missing var out by accident, but thanks a lot for helping out, it's a lot clearer now. I didn't know about that $(this.form) constructor, I'll certainly try that as well. On Fri, Sep 19, 2008 at 12:26 AM, Richard D. Worth <[EMAIL PROTECTED]> wrote: > Ah, you're missi

[jQuery] Re: How to use context and reference it inside a jquery object

2008-09-18 Thread Richard D. Worth
Ah, you're missing the var keyword. Compare your eachForm = $(this); to Dave Methvin's var $form = $(this); That's why you were always getting the last form element. No var keyword means global scope means no closure. - Richard On Thu, Sep 18, 2008 at 9:36 PM, Ariel Barreiro <[EMAIL PROTECTED

[jQuery] Re: How to use context and reference it inside a jquery object

2008-09-18 Thread Dave Methvin
If you want to do something to every form on the page, you don't need a class named form, just select the element. The "this" element in the each is the DOM element, so you can create a jQuery object from that. If you wanted you could use that element in a closure, or remember the an input DOM ele

[jQuery] Re: How to use context and reference it inside a jquery object

2008-09-18 Thread Richard D. Worth
How about a different approach? $(":input").parents("form"); - Richard On Thu, Sep 18, 2008 at 9:36 PM, Ariel Barreiro <[EMAIL PROTECTED]> wrote: > > I have a question, is there a way to reference the context in a way > such as $(this)? > > for example, let say I have this (using general select