Home >Web Front-end >JS Tutorial >jquery gets tagName and then makes a judgment_jquery

jquery gets tagName and then makes a judgment_jquery

WBOY
WBOYOriginal
2016-05-16 16:46:201228browse

If you want to get the tagName and then make a judgment, it will be more convenient to use the following code directly:

$(element).is('input')

If you want to get the tag To use it elsewhere, you can use the following code:

$(element)[0].tagName
or:
$(element).get(0).tagName

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