In <html>
tag I have attribute lang
. How do I reach it using .js. I want to use contains of lang as a variable. So as I understand it should start with var lang = ???
?
In jQuery:
var theLanguage = $('html').attr('lang');
alert(theLanguage);
If you wanna fiddle: http://jsfiddle.net/NX367/
If you want to do it in plain Javascript, this site will explain better than I:
http://www.javascriptkit.com/dhtmltutors/domattribute.shtml
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With