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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T04:53:27+00:00 2026-06-05T04:53:27+00:00

I have a div that when the page is loaded is set to display:none;

  • 0

I have a div that when the page is loaded is set to display:none;. I can open it up using this simple code:

$(".field-group-format-toggler").click(function()
{
$(".field-group-format-wrapper").css({'display':'block'});
});

Once it’s opened, I’d like the user to be able to close it so I tried using the .is(‘:visible’) function and then wrapping my original code in an if statment but this time using display:none;

if($('.field-group-format-wrapper').is(':visible')){

   $(".field-group-format-toggler").click(function()
  {
    $(".field-group-format-wrapper").css({'display':'none'});
 });

}

This does not seem to work though and I am not getting any syntax errors that I know of.

I also tried this:

if ($('.field-group-format-wrapper').is(':visible'))
$(".field-group-format-toggler").click(function () {
$(".field-group-format-wrapper").css({'display':'none'});
});

… but that did not work either.

  • 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-05T04:53:28+00:00Added an answer on June 5, 2026 at 4:53 am

    You can just use the toggle function:

    $(".field-group-format-toggler").click(function()
    {
      $(".field-group-format-wrapper").toggle();
    });
    

    This will show the '.field-group-format-wrapper' elements if they are currently hidden and hide them if they’re currently visible.

    FYI the reason your code snippet in your question wasn’t working is because you’re only checking the visibility of the elements on dom ready, rather than on each click – so the event handler to show the elements will never be attached.

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

Sidebar

Related Questions

hey there, i have a div that expands when the page is loaded, now
I have a page ItemList that shows a list of items using div's. After
At the top of my page I have a div that spans the page,
I have a div that covers the entire page width=100% and height=100% . I
I have a div that I would like to reposition each time the page
I have an html page which contains a div that displays the html from
I have a div (sub area of page with scroll bar) that has some
I have an ASP.NET page that contains two div's. Both have search fields and
The Idea I have a main PHP page that loads content in DIV's from
I have an ASP.Net page that contains a <div> with an <img> tag within.

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.