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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T01:12:16+00:00 2026-06-12T01:12:16+00:00

I have a div that if clicked toggles another div further down the page.

  • 0

I have a div that if clicked toggles another div further down the page.

This is the HTML of the div that should do the toggling:

<div id="ch_display_linkedin_icon" class="asw-switch-link">
<a class="link-true active" rel="true" href="#"></a>
<a class="link-false" rel="false" href="#"></a>
</div>

You will notice that the link-true class has another attribute of
active. This is added by another art of jQuery if the div if clicked.

At the moment a with the active class is the active div.

What I want to do is change the value of another div further down the page called #LinkedIn dependent on the value of the #ch_display_linkedin_icon

Basically I want to say, if

<a class="link-true active" rel="true" href="#"></a>

has the class of active then display the #LinkedIn div otherwise if

<a class="link-false active" rel="false" href="#"></a>

has the active then hide the #LinkedIn div.

What I need to do is using jQuery be able to get the value of the ch_display_linkedin_icon and display the #LinkedIn div only if it has the active class.

Have started with

$('#ch_display_linkedin_icon').live("click", function() {
});

but am not sure how to get the child element of the a.

Any help would be greatly appreciated.

  • 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-12T01:12:17+00:00Added an answer on June 12, 2026 at 1:12 am

    I’d do something like this:

    $(document).on('click', '#ch_display_linkedin_icon', function() {
        $('#LinkedIn').toggle($('a.link-true.active', this).length > 0);
    });
    

    Ideally, replace document with the selector of the element that contains #ch_display_linkedin_icon.

    If #ch_display_linkedin_icon is not being dynamically generated by JavaScript, you can simplify the code a little:

    $('#ch_display_linkedin_icon').click(function() {
        $('#LinkedIn').toggle($('a.link-true.active', this).length > 0);
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a simple jQuery function that toggles a div's visibility when clicked. The
I have a usercontrol that hides a div when a button is clicked. <asp:LinkButton
I have a button that when clicked, should only execute its code if the
I have a link_to that toggles a boolean field when clicked. The problem is
I have a fairly mundane piece jQuery that toggles a div's visibility when a
I have some divs on my page that when a link is clicked they
I have a basic toggle switch that shows the clicked on div while closing
I have a login box that slides/toggles up and down when an <a> link
i have a div which when clicked has another div underneath it slide up
I have a div that expands to the height of it's content. It works

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.