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 8804003
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T01:29:27+00:00 2026-06-14T01:29:27+00:00

I have a TODO list app with an Unordered list. Within it I have

  • 0

I have a TODO list app with an Unordered list. Within it I have a few list items. The li classes are high,medium,low. I would like li’s with the class high to be placed before li’s with the class medium and last ones with low.

<ul id="tasks">
  <li id="item3" class="priority low"><span></span><a href="#" class="closex" onclick="removeItem('item3')"></a><span>This is a low priority task</span></li>
  <li id="item4" class="priority high"><></span><a href="#" class="closex" onclick="removeItem('item4')"></a><span>This is a high priority task</span></li>
  <li id="item5" class="priority low"><span></span><a href="#" class="closex" onclick="removeItem('item5')"></a><span>This is another Low</span></li>
  <li id="item7" class="priority medium"><span></span><a href="#" class="closex" onclick="removeItem('item7')"></a><span>And now a Medium</span></li>
</ul>

So the li with id of item4 should be first and then it should be item7 and then the li’s with class low after.

  • 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-14T01:29:28+00:00Added an answer on June 14, 2026 at 1:29 am

    Here’s a pure JS version of @ŠimeVidas jQuery solution.

    var tasks = document.querySelector('#tasks'),
        items = document.querySelectorAll('#tasks > li');
    
    for (var i = 0, arr = ['high', 'medium', 'low']; i < arr.length; i++) {
        for (var j = 0; j < items.length; j++) {
            if (~(" " + items[j].className + " ").indexOf(" " + arr[i] + " "))
                tasks.appendChild(items[j]);
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an app that is a list of tasks, like a to do
I have a list of TODO items, and I'm trying to have 2 TODO
I have CameraList class that provides Cameras list like SONY,VIVOTEK,VIVOTEK 7XXX,PIXORD,TOSHIBA,JVC E-CON... And I
im making a todo list app in php and im using unordered lists to
I'm using django-taggit to tag items in a todo list app. I'm trying to
Let's say I have an app that handles a TODO list. The list has
I have a todo list app I'm working on. It displays the timestamp from
In my app, I have a task list (no, it's not just another todo
E.G. to create an ArrayList of Strings we have to do something like List<String>
I have code which needs to do something like this There is a list

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.