Jerpl Jerpl - 4 months ago 20
CSS Question

Append declared language to html?

How could I add 'lang="en"' to the end of my opening html tag? I can't just write it in there manually as I don't have access to it (ecommerce package), but I'd like to be able to declare the site language somehow.

Answer

You can change the attributes of any element using .attr()

$('html').attr('lang','en');

With plain JS, you can also access the <html> element with the documentElement:

document.documentElement.lang = 'en';