How to obtain lang attribute in HTML using JavaScript?

后端 未结 2 1775
甜味超标
甜味超标 2020-12-08 18:29

How to obtain lang attribute in HTML using JavaScript?


         


        
2条回答
  •  攒了一身酷
    2020-12-08 18:41

    Just.

    document.getElementsByTagName('html')[0].getAttribute('lang');
    

    And with the namespace

    document.getElementsByTagName('html')[0].getAttribute('xml:lang');
    

提交回复
热议问题