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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T06:17:44+00:00 2026-06-04T06:17:44+00:00

I really stuck with my code, It’s working fine except one thing, I need

  • 0

I really stuck with my code, It’s working fine except one thing, I need to close any opened divs, when I click other div to open, here is my code:

function readFaq() {

$('.find-faq-inner h3').prepend('<span id="spanfaq" class="faq-open"></span>');

$('.find-faq-inner h3').each(function () {
    var tis = $(this), state = false;
    var answer = tis.next('div').hide().css('height', 'auto').slideUp();

    tis.click(function () {
        state = !state;
        answer.slideToggle(state);
        tis.toggleClass('active', state);

        if (state == true) {
            tis.find('#spanfaq').removeClass('faq-open');
            tis.find('#spanfaq').addClass('faq-close');
        }
        else {
            tis.find('#spanfaq').removeClass('faq-close');
            tis.find('#spanfaq').addClass('faq-open');
        }

    });
    });
}


<div class="find-faq-inner">
    <div class="text">
    <h3>FAQ1</h3>
    <div>
    text of faq
    </div>
    </div>
</div>

Any ideas would be helpful, Thanks

  • 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-04T06:17:46+00:00Added an answer on June 4, 2026 at 6:17 am
    function readFaq() {
    
    $('.find-faq-inner h3').prepend('<span id="spanfaq" class="faq-open"></span>');
    
    $('.find-faq-inner h3').each(function () {
        var tis = $(this), state = false, answer = tis.next('div').hide().css('height', 'auto').slideUp();
        tis.click(function () {
            state = !state;
    
           $('.find-faq-inner .text div').hide();// This will hide all the divs
    
            answer.slideToggle(state);
            tis.toggleClass('active', state);
    
            if (state == true) {
                tis.find('#spanfaq').removeClass('faq-open');
                tis.find('#spanfaq').addClass('faq-close');
            }
            else {
                tis.find('#spanfaq').removeClass('faq-close');
                tis.find('#spanfaq').addClass('faq-open');
            }
    
        });
        });
    }
    

    In the above function I have added
    $('.find-faq-inner .text div').hide();

    This will hide all the divs in the find-faq-inner div, use it accordingly in your code.

    To be in more safe you can also use

    $('.find-faq-inner .text > div').hide();

    It will hide only those divs which are direct child of div of class text

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

Sidebar

Related Questions

Hey, I'm really stuck with my project here... I need to know when any
I'm really stuck on why the following code block 1 result in output 1
I am having a weird problem here, and I am really stuck, need to
Really stuck on trying to write code to unzip a file or directory on
Can anyone help me here. I am really stuck. In my code if no
I am having a weird problem here, and I am really stuck, need to
I seem to be really stuck on something. I have a function to check
I'm really stuck. I've used cron on many machines, but I simply can not
Ok so I am really stuck now. I have a h:datatable and the only
What I am really stuck with, is to create word art type effects dynamically

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.