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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T05:33:49+00:00 2026-06-17T05:33:49+00:00

I have a blog in two languages. i want to toggle between language A

  • 0

I have a blog in two languages. i want to toggle between language A and B when clicking FlagA.png or FlagB.png. Every post contains at least two flags images. How can I do this using (bootstrap) Jquery? (context, I dont have a DB, in order to facilitate multi languages I want to make use of the toggle functions)

                    <div class="post">
                    <div class="post-content">
                        <div class="post-title"><a href="#"><b>title</b</a>                </div>
                        <a href="" class="languageA">
                                <img src="img/countryA.png" alt=""
                                    style="float: right;" /></a>
                        <a href="" class="languageB">
                                <img src="img/countryB.png"  alt="" style="float: right;
                                    padding-right: 10px;" /></a>
                        </br>
                        <div class="post-description">
                        <p>
                            post in language A
                        </p>
                        </div>
                        <div class="post-description">

                        <p>
                            post in language B but now it is invisible, when pressed countryB image this becomes visible and post in language A not.
                        </p>
                        </div>
                    <p class="test"> test test test test test test test test test test test test</p>
                   </div>
                   <div class="post">
                   <!-- second post\-->
                   </div>
                   <!-- -->
                   <script type="text/jscript">
                  $(function() {
        $('.languageA').click(function () {
            $('.test').collapse({
                toggle: true
            })
        });
    });
                   });
                   </script>
  • 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-17T05:33:51+00:00Added an answer on June 17, 2026 at 5:33 am

    You can do this by the following method:

    1. For all the content you want to toggle, you must give it the relevant language class. In the example below, I gave the title, country flag and post description a language class.
    2. Use the click function to toggle the content with each language class when clicked. In this example, I limit the toggle to each post by using $(this).parent so you could read one post in one language and another in a different language.
    3. Then you also implement a callback in each toggle to show the other language when the toggle has completed.

    Here is the HTML:

    <div class="post">
        <div class="post-content">
          <div class="post-title languageA"><a href="#"><b>Title 1 in Language A</b></a></div>
          <div class="post-title languageB"><a href="#"><b>Title 1 in Language B</b></a></div>
            <a href="#" class="languageA">
              <img src="http://flags.redpixart.com/img/united_states_of_america_preview.gif" alt=""
              style="float: right;" /></a>
            <a href="#" class="languageB">
              <img src="http://flags.redpixart.com/img/spain_preview.gif"  alt="" style="float: right;
                                        padding-right: 10px;" /></a>
          <br/>
          <div class="post-description languageA">
            <p>
              Post 1 in language A
            </p>
          </div>
          <div class="post-description languageB">
            <p>
              Post 1 in language B
            </p>
          </div>
          <p class="test"> test test test test test test test test test test test test</p>
        </div>
    </div>
    

    And then the following JavaScript will toggle the language:

    $(function() {
       // Hide Language B when the web page loads
       $('.languageB').hide();
       $('.languageA').click(function () {
           // find all content with .languageA under the div post-content and hide it
           $(this).parent().find('.languageA').fadeToggle('slow',function() {
                 // find all content with .languageB under the div post-content and show it
                 $(this).parent().find('.languageB').show();});
       });
       $('.languageB').click(function () {
           // find all content with .languageB under the div post-content and hide it
           $(this).parent().find('.languageB').fadeToggle('slow',function() {
                 // find all content with .languageA under the div post-content and show it
                 $(this).parent().find('.languageA').show(); });
       });
    });
    

    JSFiddle is here.

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

Sidebar

Related Questions

I have a blog app and i want to show each post in a
i have two model which are Post and Profile. i am keepin blog datas
I have two tables userdetails and blog question The schema is UserDetails: connection: doctrine
I have two questions: From personal experience, what free blog engine is the best
Two questions only: I have a website including a section of Blog in wordpress.
http://www.brixwork.com/realtors/blog/marketing-promotion/combining-pdfs-online-for-a-comprehensive-presentation/ I have two occurrences of <ol><li> s in this blog post. The first
Lets say i have a blog with 10 posts. I want to display 20
i have a mini blog app, and a 'timeline' . there i want to
Say on a site I have a blog and portfolio. These are the two
What I am trying to do: I have a blog and want to show

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.