tags:

views:

202

answers:

2

Hi all, suppose I have an html document that looks like :

<html lang="en">
...
</html>

my question is : how to get the value of the attribute lang with jQuery? I've tried $("html").attr("lang") but it did not work ... any suggestions ?

thanks a lot !

A: 

Use .attr()

alert($('html').attr('lang'));

smack0007
How is this different from what the OP (apparently) tried?
molf
that does not work - try it at http://www.jsbin.com
Russ Cam
I have vote myself down. I missed the part where he said what he did already.
smack0007
+1  A: 

Access the attribute directly, ex :

$('html')[0].lang
OneOfOne