Home  >  Article  >  Web Front-end  >  jquery tagname 取得方法_jquery

jquery tagname 取得方法_jquery

WBOY
WBOYOriginal
2016-05-16 18:52:11926browse

如果你查找Jquery的API,会发现这个好象是Jquery的一个盲点,找来找去也没有明确说明用什么办法可以取到HTML标签的名字,如果直接用
$("H1").tagName
这样的方式也无法取到“H1”这样的值,好象只会得到“undifined”。

后来发现Jquery居然将tagName也视为属性之一了,有趣。
所以用
$("H1").attr("tagName")



[Ctrl+A 全选 注:如需引入外部Js需刷新才能执行]
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn