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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T17:32:13+00:00 2026-05-13T17:32:13+00:00

Doing a german site, and have a JS alert to say you havn’t completed

  • 0

Doing a german site, and have a JS alert to say you havn’t completed all the required fields.

So want to get the langage of the HTMLpage

Here’s the HTML;

<html xml:lang="de" xmlns="http://www.w3.org/1999/xhtml">
  ...
</html>

This is my JS…. it seems to error and not alert at all with the lang bits…

How do it get the xml:lang attribute?

var lang = document.getElementByTagname("html").attributes.getNamedItem("xml:lang").value;
                alert("You must complete all the required information");
                alert(lang);
  • 1 1 Answer
  • 1 View
  • 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-05-13T17:32:14+00:00Added an answer on May 13, 2026 at 5:32 pm

    Since you have an xml:lang attribute and not a lang attribute, you aren’t writing HTML Compatible XHTML, therefore:

    var htmls = document.getElementsByTagNameNS('http://www.w3.org/1999/xhtml', 'html');
    var html = htmls[0];
    var lang = html.getAttributeNS('http://www.w3.org/XML/1998/namespace', 'lang');.
    

    (OK, this is slightly tongue in cheek. You should probably fix your markup to conform to the compatibility guidelines instead. Then just

    document.getElementsByTagName('html')[0].lang
    

    )

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

Sidebar

Related Questions

I'm doing my first htaccess steps and going nowhere... I have a site in
I have a multi language site (German & English) in cakephp . But here
I've got a German VisualStudio 9.0. Working with doubles and doing quite some parsing,
Doing the getting started of Sinatra. I get this error: ./sinatra.rb:5: undefined method `get'
Doing an ajax get request works as expected using the following code: $.ajax({ type:
Doing some jquery animation. I have certain divs set up with an attribute of
Doing code analysis of the project and get the message Reference-counted object is used
What I am doing is that I have a file which contains some data
I should be doing something wrong. What is the XPath query for all nodes
I have a Qt project with a german translation, Translation_de.ts , which is automatically

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.