Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7784641
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T20:07:39+00:00 2026-06-01T20:07:39+00:00

is there is simple way to sort only the outer level of multilist level

  • 0

is there is simple way to sort only the outer level of multilist level in HTML?
(it’s not important to sort the inner level of the lists)
If possible just javascript code, no jQuery since i never used it.

Example: Before sorting

  1. List Z

    • Katty
    • Della
  2. List G

    • Test
    • fox
  3. List R

    • ABC
    • AAC

After sorting:

  1. List G

    • Test
    • fox
  2. List R

    • ABC
    • AAC
  3. List Z

    • Katty
    • Della

Thank you in advance
Mike

After using the Jquery method answered below, i got error “Object does not support this property or method??

Update: here is acode sample:

<head>

<script LANGUAGE="JavaScript" SRC="./js/jquery-1.7.2.js"></SCRIPT>
<script type="text/javascript">



    function sortDesc()
    {
        $('ul.list > li').sortElements(function(a, b){
        return $(a).text() > $(b).text() ? 1 : -1;});
    }

</script>
</head>

<body>
    <div id="container">
        <div id="main">
            <div class="c1">
                <div id="example-list">
                    <table cellspacing="0" cellpadding="0" border="0" width="100%">
                        <tr>
                            <td align="middle"     align="center" title='sort' style="cursor:pointer" valign="middle" align="center"  style="width:20px; height:20px;">
                                <img border="0" src="./js/r_oinfo.gif" width="20" height="20"  onclick="sortDesc()">
                        </td>
                    </table>
                    <ul class="list">
                        <li>
                            Search

                        </li>
                        <ul>
                            <li>
                                se 1
                            </li>
                            <li>
                                se 2
                            </li>
                            <li>
                                se 0
                            </li>
                        </ul>
                        <li>
                            Sort
                        </li>
                        <ul>
                            <li>
                                so 1
                            </li>
                            <li>
                                so 0
                            </li>
                        </ul>
                        <li>
                            Filter

                        </li>
                    </ul>
                 </div>
            </div>

        </div>
    </div>
</body>
</html>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T20:07:40+00:00Added an answer on June 1, 2026 at 8:07 pm

    This may be a good opportunity to start learning about jQuery; it has a lot to offer when it comes to DOM operations.

    There’s a nice write-up of element sorting using jQuery at http://james.padolsey.com/javascript/sorting-elements-with-jquery/.

    Using the sortElements approach outlined above, the following should allow you to sort your list (assuming that the top-level ul has a class of toplevellist).

    $('ul.toplevellist > li').sortElements(function(a, b){
        return $(a).text() > $(b).text() ? 1 : -1;
    });
    

    There’s a complete example at http://qd9.co.uk/projects/jQuery-Plugins/sort/demo.html. To use this on your site you need to:

    1) Add a jQuery script reference to your web page (e.g. <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>)

    2) Save the file jquery.sort.js from the example and copy it to your server, and add it to your web page as a script reference.

    3) Add a call to the sortElements function in the example.

    If you definitely do not want to use jQuery, then the approach outlined at that page can still be used, depending on your level of JavaScript knowledge.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is there a simple way to see assigned shortcuts with given prefix? Something similar
Is there a simple way to have isometric projection? I mean the true isometric
Is there a simple way to work with C++ objects directly from C? I
Is there a simple way to convert MP3 to WAV in vb2005? what i
Is there a simple way or method to convert a Stream into a byte[]
Is there a simple way of redirecting serial port output to a file, that
Is there a simple way of rendering to a BufferedImage in Java3D? I know
Is there any (simple) way to get some control of the order in which
Is there some simple way to send out a ping-style message to a remote
Is there a simple way, using C#, to open an arbitrary URL, read in

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.