tagName


document.getElementById("demo").tagName;  //p标签就返回P

定义和用法

tagName 属性返回元素的标签名。

在 HTML 中,tagName 属性的返回值始终是大写的。