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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T18:00:57+00:00 2026-06-04T18:00:57+00:00

I have the following JS code on my site: function foo(link) { alert(‘ID=’ +

  • 0

I have the following JS code on my site:

function foo(link) {
    alert('ID=' + link.DocumentID + '; Lang=' + link.Language);
}

which should be called on each click on the following link:

<a href='http://www.example.com' DocumentID='someDocId' Language='en' onclick='foo(this);'>Example page</a>

(this is just a simplified version of my actual code, but it works exactly the same; I needed few nonstandard attributes, like DocumentID and Language for tracking purposes).

The problem is that foo() function does not fire on click event. When I changed the Language attribute name to i.e. Lng function everything works fine. I’ve tested it on IE7/8 and FF (the most current version).

According to W3C HTML4 standard Language attribute is not valid for anchor tag. I know it’s valid for <script> tag but I don’t see any relation.

Does anybody know why setting the Language attribute prevented from firing onclick event (I haven’t tried with other event types but they also could be affected)?

  • 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-04T18:00:58+00:00Added an answer on June 4, 2026 at 6:00 pm

    Only IE 7/8 synchronizes custom attributes and properties.

    link.href; // 'http://www.example.com'
    link.language; // undefined (except in IE 7/8)
    

    It’s preferable to use getAttribute:

    link.getAttribute('href'); // 'http://www.example.com'
    link.getAttribute('language'); // 'en'
    

    Attributes are case-insensitive in HTML, and case-sensitive in XML documents (including XHTML).

    Don’t confuse deprecated language attribute on HTMLScriptElement with lang attribute on HTMLElement.

    P.S. Like someone already said, it’s better to use HTML5 data-* attributes.

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

Sidebar

Related Questions

I have the following code in my application: $(.deleteproduct).click(function() { id = this.id; alert(id:
I have some JS on my site that should prevent the following code from
I'm using the datepicker form jQuery-ui-1.8.16. I have the following code: Site.Calendar = function()
I have the following javascript code: function initSite(){ var site; $.getJSON(www+'init/initSite', function(data) { site
So if I have the following code: function DoSomething { $site = Something $app
I have the following code snippet: using (SPSite site = new SPSite(this.ListAddress)) { using
From this site: http://www.toymaker.info/Games/html/vertex_shaders.html We have the following code snippet: // transformations provided by
I have an ASP.NET web site with something similar to the following code: .aspx
I am writing code to performance test a web site. I have the following
I have added the following code to my site to prevent tabbing, this applies

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.