Did you try adding an empty <ul> after it?
ex:
<div class="accordion">

                        <h2>Category 1</h2>
                        <ul>
                                <li><a href="#">Subcategory 1</a></li>
                                <li><a href="#">Subcategory 2</a></li>
                                <li><a href="#">Subcategory 3</a></li>
                                <li><a href="#">Subcategory 4</a></li>
                        </ul>

                        <h2>Category 2 (WITHOUT SUBCATEGORIES!!!)</h2>
                        <ul></ul>

                        <h2>Category 3</h2>
                        <ul>
                                <li><a href="#">Subcategory 1</a></li>
                                <li><a href="#">Subcategory 2</a></li>
                        </ul>

                        <h2>Category 4</h2>
                        <ul>
                                <li><a href="#">Subcategory 1</a></li>
                                <li><a href="#">Subcategory 2</a></li>
                        </ul>

                </div>

On Dec 11, 3:15 am, njafi <[email protected]> wrote:
> I'm totally new to JS and i could really use some help with this.
>
> I'm doing a navigation menu using the accordion. Everything work fine
> when it follows the "header, ul, header, ul" rhythm, but when a
> category doesn't have subcategories listed after it, everything messes
> up.
>
> How do i fix that? Thanks in advance.
>
> This is my HTML structure:
>                 <div class="accordion">
>
>                         <h2>Category 1</h2>
>                         <ul>
>                                 <li><a href="#">Subcategory 1</a></li>
>                                 <li><a href="#">Subcategory 2</a></li>
>                                 <li><a href="#">Subcategory 3</a></li>
>                                 <li><a href="#">Subcategory 4</a></li>
>                         </ul>
>
>                         <h2>Category 2 (WITHOUT SUBCATEGORIES!!!)</h2>
>
>                         <h2>Category 3</h2>
>                         <ul>
>                                 <li><a href="#">Subcategory 1</a></li>
>                                 <li><a href="#">Subcategory 2</a></li>
>                         </ul>
>
>                         <h2>Category 4</h2>
>                         <ul>
>                                 <li><a href="#">Subcategory 1</a></li>
>                                 <li><a href="#">Subcategory 2</a></li>
>                         </ul>
>
>                 </div>

--

You received this message because you are subscribed to the Google Groups 
"jQuery UI" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/jquery-ui?hl=en.


Reply via email to