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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T11:45:24+00:00 2026-05-23T11:45:24+00:00

I have a page with a bunch of fake dropdown menus that are coded

  • 0

I have a page with a bunch of fake dropdown menus that are coded like this (I can’t really change the HTML):

<div class="select">
    <div class="wrapper calcdropdown">
        <a href="#" class="dd-openercalc">Select a calculator</a>
        <a href="#" class="dd-opener pulldown-arrow">&nbsp;</a>
    </div>
    <ul class="selectbox">
        <li>Dropdown item 1</li>
        <li>Dropdown item 2</li>
        <li>Dropdown item 3</li>
    <ul>
</div>

When I click on either of the links inside the calcdropdown DIVs I need to toggle the corresponding selectbox UL. When I use toggle() the selectbox UL appears when I first click the links but doesn’t disappear when I click the links again.

var $j = jQuery.noConflict();
$j(document).ready(function() {
    // hide all the dropdowns by default
    $j(".selectbox").hide();

    $j('.calcdropdown a').live('click',function(e) {
        // hide the dropdowns in case another one's open
        $j(".selectbox").hide();
        var self = $j(this);
        // show the selectbox for this link
        var thisSelectbox = $j(this).parents('.select').children('.selectbox').toggle();
        e.preventDefault();
    });
});

This doesn’t work, either:

var $j = jQuery.noConflict();
$j(document).ready(function() {
    $j(".selectbox").hide();

    $j('.calcdropdown a').live('click',function(e) {
        $j(".selectbox").hide();
        var self = $j(this);
        var thisSelectbox = $j(this).parents('.select').children('.selectbox');
        if(thisSelectbox.is(':hidden')) {
            thisSelectbox.show();
        } else {
            thisSelectbox.hide();
        }
    });
});

How can I hide the selectboxes after I show them?

  • 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-23T11:45:25+00:00Added an answer on May 23, 2026 at 11:45 am

    Remove $j(".selectbox").hide(); from the click-function.

    Otherwise you always do this steps inside the click-function:

    1. hide the element
    2. toggle the element(makes it visible all the time, because you hide it before)

    Edit:(I didn’t realize that you use more than one of those elements)

    To hide all .selectbox except the one related to the click use not():

    var $j = jQuery.noConflict();
    $j(document).ready(function() {
        // hide all the dropdowns by default
        $j(".selectbox").hide();
    
        $j('.calcdropdown a').live('click',function(e) {
    
            var target=$j(this).parents('.select').children('.selectbox');
                $j('.selectbox').not(target.toggle()).hide();
                e.preventDefault();
        });
    });
    

    http://jsfiddle.net/doktormolle/qG8ps/

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

Sidebar

Related Questions

I have a page that lists a bunch of files. This page can be
I have a page that loads a bunch of scripts to prepopulate dropdowns and
I have a page that has a bunch of user controls on it. I
I have a page that will basically be used to concatenate a bunch of
In my page I have a bunch (about 30) dom nodes that should be
I have a page that shows a bunch of thumbnails (around 30), and the
I have a master page with a bunch of menu like: <ul id=ulMenu runat=server>
I have a page that has a bunch of widgets on it. Each widget
I have index page with navigation menu like this man caps shirt jeans woman
I have a page that I have created with a whole bunch of 'feed

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.