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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T11:35:43+00:00 2026-06-09T11:35:43+00:00

I am using twitter bootstrap and looking for a drop down that will look

  • 0

I am using twitter bootstrap and looking for a drop down that will look like a button group. The problems are that in all the twitter bootstrap example, the drop down is only act as a menu item so the selected item is not really changed:
http://twitter.github.com/bootstrap/javascript.html#dropdowns

Does anyone have idea how can I design drop downs like the button group?

  • 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-09T11:35:44+00:00Added an answer on June 9, 2026 at 11:35 am

    I convert this web finding to a jquery plugin:

    (function($) {
        $.fn.buttonSelect = function() {
            this.hide().wrap('<div class="btn-group"/>');
            var select = this.parent();
            var selectedOption=this.find('option[selected]').length>0?this.find('option[selected]'):this.find('option:nth(0)');
            var currentValue = selectedOption.val();
            var currentText = selectedOption.text();
            select.html(
                '<input type="hidden" value="' + this.val() + '"/>'+
                '<a class="btn dropdown-toggle" data-toggle="dropdown" href="javascript:;">'+
                    '<span>'+currentText+'</span>'+
                    '&nbsp;&nbsp;<span class="caret"></span>'+
                '</a>'+
                '<ul class="dropdown-menu"></ul>');
    
            var dropdownMenu=select.find('.dropdown-menu');
            this.find('option').each(function(o, q) {
                dropdownMenu.
                    append('<li><a href="javascript:;" data-value="' + $(q).attr('value') + '">' + $(q).text() + '</a></li>');
            });
    
            var hidden=select.find('input[type=hidden]');
            var label=select.find('.btn span:nth(0)');
            dropdownMenu.find('a').click(function() {
                hidden.val($(this).data('value')).change();
                label.text($(this).text());
            });
    
            return this;
        };
    })(jQuery);
    

    Then, using $(elem).buttonSelect(); makes the select element look like the button group .

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

Sidebar

Related Questions

I just started using Twitter Bootstrap http://twitter.github.com/bootstrap/scaffolding.html and I'm looking for the grey/blue navbar
I was looking to using the Twitter Bootstrap Modal windows as a partial view.
I am using twitter bootstrap and I would like a container div to stretch
I developed a site using twitter bootstrap and it seems that the responsive layout
I was looking at the jQuery plugins for Twitter Bootstrap and saw that they
I'm trying to do an image group with fancybox (I'm also using twitter bootstrap,
I'm using twitter bootstrap. It has collapse module. I'm using it like this. <a
I am using Twitter Bootstrap in a project, and would like to contrain the
I am building a website using the twitter bootstrap base so that i can
I have a HTML Div (I'm using Twitter Bootstrap to hide-show div2 ) looking

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.