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

  • Home
  • SEARCH
  • 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 496123
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T05:39:23+00:00 2026-05-13T05:39:23+00:00

Whet I need to do is in my menu I would like to add

  • 0

Whet I need to do is in my menu I would like to add one of the classes (listed below) with completely random order every time when function starts (page load)

This is my HTML

<div id="menu">
    <ul>
        <li><a href="#">Home</a></li>
        <li><a href="#">About Us</a></li>
        <li><a href="#">Portfolio</a></li>
        <li><a href="#">Why Us</a></li>
        <li><a href="#">Contact Us</a></li>
    </ul>
</div>

And this is what I would like to have as the result with every time different order of added classes

<div id="menu">
    <ul>
        <li><a href="#" class="li-one" >Home</a></li>
        <li><a href="#" class="li-five">About Us</a></li>
        <li><a href="#" class="li-three">Portfolio</a></li>
        <li><a href="#" class="li-two">Why Us</a></li>
        <li><a href="#" class="li-four">Contact Us</a></li>
    </ul>
 </div>

Below I have listed all the classes.

.li-one .li-two .li-three .li-four .li-five

I have spent lost hour trying to figure that out with no results

Thank you very much for your help in advance

  • 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-05-13T05:39:23+00:00Added an answer on May 13, 2026 at 5:39 am

    Something like the following:

    function randOrd() {
        return (Math.round(Math.random())-0.5); 
    }
    
    $(document).ready(function() {
        var klasses = [ 'li-one', 'li-two', 'li-three', 'li-four', 'li-five' ];
        klasses.sort( randOrd );
        $('#menu ul li a').each(function(i, val) {
            $(this).addClass(klasses[i]);
        });
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

whet i am starting new Activity using this way below Intent edit = new
I am trying to add calendar event using the below code in my android
I have struct that store info about ARP packet and I need to save
This is a design question, to whet the guru's appetite. In a previous version,
Whet are things to look for when trying to optimize a mysql query that
I've asked a question about changing the version of .Net sites in the IIS.
I have a small problem with jQuery $.ajax() function. I have a form where
Is it possible to send from PHP, data that can be retrieved with jQuery
Heroku does not have built-in SQL console, so I have used the third party
I want to integrate Tweet button into a Google Maps v3 infoWindow (infoBox), with

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.