开发者

How to get ID of HTML element?

开发者 https://www.devze.com 2023-03-19 23:58 出处:网络
So the code below will get the开发者_运维知识库 ID of the BODY elementL var bodyId = document.body.id;

So the code below will get the开发者_运维知识库 ID of the BODY elementL

var bodyId = document.body.id;

How can I get the ID of the HTML element using plain ole' JavaScript?


document.documentElement.id


document.getElementsByTagName('HTML')[0].id
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号