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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T11:54:28+00:00 2026-05-20T11:54:28+00:00

I have a function that toggles hidden divs and works beautifully at it. unfortunately,

  • 0

I have a function that toggles hidden divs and works beautifully at it. unfortunately, the “brand” section just got changed to “the brand.” the code was graciously improved and written dynamically by one of you geniuses and uses the anchor’s content name to select the div to show/hide. unfortunately i need THE (space) BRAND. No bueno!

Ideas? Thank you!

p.s. this function works if you take THE out of the “show_brand” anchor.

HTML:

    <div id="nav">
        <div id="nav_left">
            <a class="home" id="show_brand" title="BRAND">THE BRAND</a><br />
            <a class="home" id="show_campaigns" title="CAMPAIGNS">CAMPAIGNS</a><br />
            <a href="collection/" title="COLLECTION">COLLECTION</a><br />
            <a class="home" id="show_inquiries" title="INQUIRIES">INQUIRIES</a>
        </div>
        <div id="campaigns">
            <a href="campaigns/neo_balletto/" title="NEO BALLETTO">NEO BALLETTO</a><br />
            <a href="campaigns/poetic_deco/" title="POETIC DECO">POETIC DECO</a>
        </div>
    </div>
    <div class="current" id="brand">
        <p>content</p> 
    </div>
    <div id="inquiries">
        <p>content</p>
    </div>

Javascript:

$('#brand, #campaigns, #inquiries').hide();
$('.home').click(function() {
    var id = $(this).html().toLowerCase();
    var $content = $('#' + id + ':not(:visible)');
    if ($('.current').length === 0) {
        showContent($content)
    }
    else {
        $('.current').fadeOut(600, function() {
            showContent($content)
        });
    }
    $('.home').css('text-decoration', 'none');
    $(this).css('text-decoration', 'underline');
});
function showContent(content) {
    content.fadeIn(600);
    $('.current').removeClass('current');
    content.addClass('current');
}
$('.close').click(function() {
    $('.current').fadeOut(600);
});
  • 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-20T11:54:29+00:00Added an answer on May 20, 2026 at 11:54 am

    Well just change

    var id = $(this).html().toLowerCase();

    to

    var id = $(this).attr("id").replace("show_","").toLowerCase();

    And your code will work ,no matter what the content of the div is

    Check http://jsfiddle.net/3AnZw/1/ for a demo

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

Sidebar

Related Questions

I have a javascript function that toggles the display for rows in a table.
In my Java code I have function that gets file from the client in
I have a set of dynamic headings and hidden divs with the idea that
I have divs that are initially closed. The code below then controls the opening/closing:
I have this tested function below that works fine for fading an element in
http://jsfiddle.net/yrM3H/2/ I have the following code: jQuery(document).ready(function() { jQuery(.toggle).next(.hidden).hide(); jQuery(.toggle).click(function() { $('.active').toggleClass('active').next('.hidden').slideToggle(300); $(this).toggleClass('active').next().slideToggle(fast); });
SO I have a tooltip which is a hidden div that toggles below the
I have a series of divs that are hidden and I would like to
So I have function that formats a date to coerce to given enum DateType{CURRENT,
I have function Start() that is fired on ready. When I click on .ExampleClick

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.