I'm using the following code to check for the lang attribute on the <html> element:
if( $("html:lang(en)") ){
// Do something
}
I've noticed that this doesn't work consistently. For instance, when lang="fr", or when no language attribute is defined, the code still gets executed.
According to the jquery docs (https://api.jquery.com/lang-selector/), it should work. How come this isn't the case? And most importantly: How do I check which lang attribute is used in a consistent manner?