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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T20:59:34+00:00 2026-05-26T20:59:34+00:00

I want to have the same functionality of select in HTML but using div

  • 0

I want to have the same functionality of select in HTML but using div and unordered list.

When the page load, the name of the button should be the the element li which has class=”selected”. It means that I have to change html of selector_button to one that has the class selected in the li tag.

Also How can I make the unordered list hide when user clicks on any part of the page or selects another item from the list.

how can i achieve this?

Code: http://jsfiddle.net/cZ36w/2/

JS thus far:

$('#select_button').html();

$('#selector_button').click(function() {
    $('#selector_list').show();
});

HTML:

<div id="selector_button">
    <ul style="display:none;" id="selector_list">
        <li class="option-selected" title="7">Everything</li>
        <li title="1">A</li>
        <li title="4">B</li>
        <li title="9">C</li>
        <li title="8">D</li>
        <li title="22">E</li>
    </ul>
</div>

CSS:

.option-selected
{
    color:#c0c0c0;
}
  • 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-26T20:59:35+00:00Added an answer on May 26, 2026 at 8:59 pm

    If I understand you want to use your <ul> list as html select box.

    Look at this: http://jsfiddle.net/cZ36w/5/

    CSS: Same

    HTML: Remove style="display:none;" from <ul>

    jQuery:

    $('#selector_button li').hide();
    $('#selector_button li.option-selected').show();
    
    
    $('#selector_button ul li').hover(function() {
        $('#selector_button ul li').show(); 
    });
    
    $('#selector_button ul li').mouseout(function() {
        $('#selector_button li').hide();
        $('#selector_button li.option-selected').show();
    });
    
    
    $('#selector_button ul li').click(function() {
        $('#selector_button ul li').removeClass('option-selected'); 
        $(this).addClass('option-selected'); 
    });
    

    It is not perfect but it will give you a direction to achieve your goal.

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

Sidebar

Related Questions

I want to have two items on the same line using float: left for
I have a dropdown select list on my page of class=TypeFilter. I have a
I am using pyQt4 and want to have a Browse button in my GUI
I have multiple images that have the same class attribute and I want to
I want to make sure that a set of functions have the same signature
I have several different lists I want to call. They all have the same
In Ruby, I want to have two threads running at the same time, and
i have a wordpress blog and want to give people the same user experience
I have two JSON objects with the same structure and I want to concat
We have two version of the same assembly in GAC? I want my client

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.