Set language of document

I would like to set the lang attribute of the HTML site. The only solution I found is as follows, but it does not work in Webflow. It seems that is functionality is ignored. No console.log or try-catch showed me anything.

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

Does somebody have a solution?

Add jQuery link at the beginning. Maybe taht will work.

<script src="http://code.jquery.com/jquery-latest.min.js" type="text/javascript"></script>
<script>$('html').attr('lang','en');</script>

Thanks for the hint, but I added the jQuery library already before :frowning:

Try this:

<script>
 $(document).ready(function() {
  $('html').attr('lang','en');
 });
</script>

Haven’t tested it.

3 Likes

I am so excited, it works! I just do not know why this makes a difference here?

Because this sets the function after the page loads. The problem is that the header will be sent using the old html lang tag. Refresh the page and check what headers are sent and recieved using some WebInspector in your browser :wink:

1 Like