Created
September 25, 2012 17:50
-
-
Save mynameispj/3783395 to your computer and use it in GitHub Desktop.
Get an element's HTML tag with jQuery
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$('.getMyHTMLTag')[0].tagName; | |
//returns 'P' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$('.getMyHTMLTag').prop('tagName'); | |
//returns 'P' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$('.getMyHTMLTag').prop('tagName'); | |
//returns 'P' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<p class="getMyHTMLTag">I need jQuery to tell me what this HTML element is</p> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment