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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T22:19:50+00:00 2026-06-07T22:19:50+00:00

I have the following script inside other elements. However, the sub countries only expands

  • 0

I have the following script inside other elements. However, the sub countries only expands and don’t collapse if clicked again. Instead, they expand again no matter how many time you clicks.

Can anyone help please?

<div id="loginContainer">
<a href="#" id="loginButton"><span style="background: #EBEBEB url('/Images/Flags/united_kingdom.jpg') right no-repeat;">United Kingdom</span><em></em></a>
<div style="clear:both"></div>
 <div id="loginBox">
  <!-- Countries Accordion starts here -->
  <ul class="the_menu">
      <li><a href="#" style="background: url('/Images/Flags/USA.gif') left no-repeat;" >United States</a></li>      
      <li>
      <a href="#" class="expand" title="Switzerland" style="background: url('/Images/Flags/USA.gif') left no-repeat;" >Switzerland ..</a>
          <ul class="submenu">
              <li><a href="#" title="Switzerland (German)" style="background: url('/Images/Flags/USA.gif') left no-repeat;;">Switzerland (German)</a></li>
              <li><a href="#" title="Switzerland (French)" style="background: url('/Images/Flags/USA.gif') left no-repeat;;">Switzerland (French)</a></li>
              <li><a href="#" title="Switzerland (Italian)" style="background: url('/Images/Flags/USA.gif') left no-repeat;;">Switzerland (Italian)</a></li>
          </ul>
      </li>
      <li><a href="#" title="Germany" style="background: url('/Images/Flags/Germany.gif') left no-repeat;;">Germany</a></li>
      <li><a href="#" class="expand" title="Canada" style="background: url('/Images/Flags/Germany.gif') left no-repeat;;">Canada ..</a>
          <ul class="submenu">
              <li><a href="#" title="Canada (English)" style="background: url('/Images/Flags/Germany.gif') left no-repeat;;">Canada (English)</a></li>
              <li><a href="#" title="Canada (French)" style="background: url('/Images/Flags/Germany.gif') left no-repeat;;">Canada (French)</a></li>
          </ul>
      </li>
      <li><a href="#" title="Turkey" style="background: url('/Images/Flags/Germany.gif') left no-repeat;">Turkey</a></li>
      <li><a href="#" title="Sweden" style="background: url('/Images/Flags/Germany.gif') left no-repeat;"> Sweden</a></li>
  </ul>
  </div> 
</div>

And the JQuery script is (please note below the new script):

$(document).ready(function () {


 var countriesContainer = $('#loginContainer');
var button = $('#loginButton');
var box = $('#loginBox');
//var form = $('#loginForm');
//button.removeAttr('href');

countriesContainer.hover(function() {
    box.toggle();
    button.toggleClass('active');
});
box.mouseup(function() { 
    return false;
});

$(this).mouseup(function(login) {
    if(!($(login.target).parent('#loginButton').length > 0)) {
        button.removeClass('active');
        box.hide();
        $('ul.submenu').hide();
    }
});

 $('ul.submenu').hide();
    $('.expand').click( function(){
        $(this).siblings('.submenu').slideToggle('normal');
        return false;
    });
});
  • 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-07T22:19:52+00:00Added an answer on June 7, 2026 at 10:19 pm

    there is problem in your markup, in one place .submenu is sibling of .expand and in another place it’s not:

    <a href="#" class="expand" title="Switzerland" style="background: url('/Images/Flags/USA.gif') left no-repeat;" >Switzerland ..</a>
              <ul class="submenu">
    

    <li><a href="#" class="expand" title="Canada" style="background: url('/Images/Flags/Germany.gif') left no-repeat;;">Canada ..</a>
              <ul class="submenu">
    

    $(document).ready(function () {
     $('ul.submenu').hide();
        $('.expand').click( function(){
            $(this).parent().next('.submenu').slideToggle('normal');
            return false;
        });
    });
    

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

Sidebar

Related Questions

I have the following script running successfully. However if I try to use a
I have the following script which first shows only the first para of the
i have the following script inside my asp.net mvc view:- function disableform(id) { $('#'
I have following script that executes all the .reg files in the current directory.
I have following small script to preview some text before submitting it to store
I have the following script below where I try to mimic a file upload
I have the following script: (function($) { $.fn.easyPaginate = function(options){ var defaults = {
I have the following script: Timer=0; function countdown(auctionid){ var auctions; var divs; Timer=Timer+1; if((Timer%10==0)||(Timer==1)){
I have the following script which appears multiple times on my page. I have
I have the following script select c.id from .TBL_COUPONS. as c inner join .TBL_BUSINESS.

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.