Home  >  Article  >  Web Front-end  >  jquery tagname acquisition method_jquery

jquery tagname acquisition method_jquery

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

If you look up Jquery's API, you will find that this seems to be a blind spot of Jquery. There is no clear explanation on how to get the name of the HTML tag. If you use
$("H1") directly. tagName
cannot get a value like "H1" in this way, it seems that it will only get "undiffed".

Later I discovered that Jquery actually regards tagName as one of its attributes, which is interesting.
So use
$("H1").attr("tagName")



[Ctrl A select all Note:
If you need to introduce external Js, you need to refresh to execute ]
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