That doesn't seem to do it either. document doesn't have a getFirst
method. So I tried $$('body')[0].getFirst('...'). That just returns
null. It looks like getFirst might only be looking within the
immediate children of the element that it is called on. I need
something that will be recursive.
The original code I wrote should have been $$('input[type!="hidden"],
select, textarea')[0]. I wasn't using the getFirst method.
On Sep 20, 3:57 pm, "Guillermo Rauch" <[EMAIL PROTECTED]> wrote:
> document.getFirst('input, select, textarea')
>
> The difference is that you're applying getFirst to an Elements collection.
> This way,
> the selector is used as a match check, so the first element that matches
> input, select, textarea
> will be returned.
>
> See the *walk* function for further details.
>
> On Sat, Sep 20, 2008 at 5:51 PM, kesmit <[EMAIL PROTECTED]> wrote:
>
> > I'm trying to figure out a way to find the first visible form input
> > element (i.e., input[type!='hidden'], select, textarea) in a page.
> > The simplest way I could think of doing this would be to do $$
> > ('input[type!='hidden'], select, textarea').getFirst(), but the $$
> > function seems to look for all of the input elements first, then the
> > select elements, and finally the textarea elements. I know about the
> > compareDocumentPosition DOM method, but it looks like it isn't
> > supported well in all browsers. Is there a way to get the first form
> > input element?
>
> > Kevin D Smith
>
> --
> Guillermo Rauchhttp://devthought.com