Skip to content

Instantly share code, notes, and snippets.

@kalupa
Created August 16, 2017 22:17
Show Gist options
  • Save kalupa/62772adebc9d7a750a7f4d6731d01658 to your computer and use it in GitHub Desktop.
Save kalupa/62772adebc9d7a750a7f4d6731d01658 to your computer and use it in GitHub Desktop.
Adds lang and xml:lang to html node.
<script type='text/javascript'>
var targetLang = "en";
var htmlEl = document.querySelector('html');
htmlEl.lang = targetLang;
htmlEl.setAttribute("xml:lang", targetLang);
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment