If I recall correctly, to get it in order you need to take all elements 
and then filter manually or do it hierarchically.

One way:
$('*',main_content).each(function() {
    if (this.tagName.toLowerCase() == 'h1')
       // ...
    else if (this.tagName.toLowerCase() == 'h2')
       // ...
    // etc.
});

The Other:
$('h1',main_content).each(function() {
    $('h2',this).each(function() {
       // and so on..
    });
});

Which one you use would depend on what your ultimate goal is, though I'm 
sure either technique can be modified to suit any situation.

-blair

sebastianw wurtz wrote:
> But still isnt what i need i making a auto gen table of content list i 
> have this
>
>     var main_content = $("#main_content");
>     var toBeTOCced = $("h2,h3,h4,h5", main_content);
>     toBeTOCced.each(function(i) {
>        .........
>        .........
>     });
>
>     * 1. Title 1
>     * 3. Title 2
>     * 4. Title 3
>     * 5. Title 4
>     * 6. Title 5
>     * 7. Title 2.1
>     * 8. Title 2.2
>     * 9. Title 4.1
>     * 10. Title 4.1
>    
> Seems to be not in order. Like is usual i need to put the
> 2
> 2.1
> 2.2
> ....
> ...
>
>
>    
>
> ----- Mensaje original ----
> De: Blair Mitchelmore <[EMAIL PROTECTED]>
> Para: jQuery Discussion. <discuss@jquery.com>
> Enviado: viernes 2 de marzo de 2007, 20:44:55
> Asunto: Re: [jQuery] get element inside a div simple question
>
> var main_content = $("#main_content");
> var toBeTOCced = $("h2,h3,h4,h5", main_content); // there it is
>
> -blair
>
> sebastianw wurtz wrote:
> > I want to get all the Heading element up to 5 (ex |h2,h3,h4,h5| )
> > inside a div like #main_content
> >
> > something like this, but inside the #main_content
> > |var toBeTOCced = getElementsByTagNames('h2,h3,h4,h5');|
> >
> > How i can do that with jquery?
> >
> >
> > thanks
> >
> > Sebastián
> >
>


_______________________________________________
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/

Reply via email to