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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T03:21:08+00:00 2026-06-15T03:21:08+00:00

First question on stack, so hurray to me! I’m trying to develop a new

  • 0

First question on stack, so hurray to me!
I’m trying to develop a new way (apparently, since I’ve seen no solution to this online, perhaps cos it’s not possible) to change the language of HTML written elements using JS and the lang property.

Basically, I have created multiple tags with the lang property in each of them, so that giving the certain lang a display value of -none-, hides it, and a value of -inherit- to show it.
In that way, using the line:

a:lang(en),p:lang(en) { display : none }
a:lang(it),p:lang(it) { display : inherit }

I can see one language at a time. And that works!

Now, I have created an

<a href="" lang="en" id="en"> word </a>

tag around the english text, and the same with any other language with their own lang property.
I have tried to use:

$("#en").click(function(){
           $('a:lang(en)').css('display', 'inherit');
           $('a:lang(it)').css('display', 'none');
           };

Which doesn’t seem to work.

Any ideas?

Thanks a bunch,
Shay

  • 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-15T03:21:09+00:00Added an answer on June 15, 2026 at 3:21 am

    When load your page come with a <body class="it">, and all the :lang(en) tags will be hidden.

    body.en :lang(it) {
      display: none;
    }
    body.it :lang(en) {
      display: none;
    }
    

    And when you need to change the language, simply change the className of <body>.

    $("#en").click(function(){
      document.body.className = 'en';
    };
    

    Which is more elegant, and way faster.

    demo: http://jsfiddle.net/Gw4eQ/


    Use :not selector to make it work with more languages. demo

    body:not(.en) :lang(en), 
    body:not(.it) :lang(it), 
    body:not(.fr) :lang(fr) { 
        display: none; 
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm new to Stack and this is my first question, but I did search
I'm new to Stack Overflow and have my first question. I want to develop
This is my first question on Stack Overflow, so I hope that I'm clear
this is my first question on stack overflow. Some quick background, this is not
I am new here and hope my first question meets stack overflow's requirements. I
( Preface: This is my first audio-related question on Stack Overflow, so I'll try
First off - hello, this is my first Stack Overflow question so I'll try
this is my first question on stack overflow, so be gentle. Let me first
Hey there guys, this is my first question on Stack Overflow. I figured this
This is my first question here on stack overflow. i need help on a

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.