On Aug 16, 8:55 pm, "Michael Geary" <[EMAIL PROTECTED]> wrote:
> > > I've been hacking with jQuery on and off lately and I've
> > > now hit the annoying problem of not being able to access
> > > simple DOM 0 properties unless, apparently, using either
> > > of the following syntaxes:
>
> > > $('#foo')[0]
> >    Will throw error if there is no match, IIRC.
>
> No, it won't. It is not an error to fetch a nonexistent array element. It
> returns undefined.
>
> You could even do $('#foo')[12345] and it wouldn't throw an error.
>
> Of course, if there is no element with id 'foo', this will throw an error:
>
>    $('#foo')[0].whatever
>
> Because $('#foo')[0] returned undefined, so you are trying to access the
> 'whatever' property of... undefined.
  <snip>

  Thanks for a nice explanation. I'm sorry for jumping without reading
it properly.

--
  <?php echo 'Just another PHP saint'; ?>
Email: rrjanbiah-at-Y!com    Blog: http://rajeshanbiah.blogspot.com/

Reply via email to