Its really simple to find things like this if you use
"console.dir($('parent-el')) this will list all the actions that are
available to you.
Said that, some of the available actions are only available in FF, thus when
you first select one test it in IE as well.
To get the first child you have many options: (two of which are)
getFirst
firstChild
I am not sure if both work in other browsers, you can also use:
var _a = $('ul').getChildren() ;
_a[0] - for the first child.
On Sat, Nov 28, 2009 at 9:55 AM, אריה גלזר <[email protected]> wrote:
> hey
> is there a way to fetch an elements immediate children? for example, for
> this layout:
> <di id='parent-el'>
> <div id='a' class='sub-el'>
> <div id='sub-el' id='c'></div>
> </div>
> <div id='b' class='sub-el'></div>
> </div>
>
> i would like to do something like *$('parent-el').getElements('>.sub-el')*to
> only fetch
> *a* and *b*. now, i know that if i know the current element's id can do
> something like:
> *$('parent-el').getParent().getElements('#parent-el>.sub-el') *
> but it seems wrong and also not very adaptive. so is there a better way of
> doing this? am i missing some magic method?
> -----------
> אריה גלזר
> 052-5348-561
> 5561
>
--
---
"Make everything as simple as possible, but not simpler."
- Albert Einstein