Skip to content

Instantly share code, notes, and snippets.

@mynameispj
Created September 25, 2012 17:50
Show Gist options
  • Save mynameispj/3783395 to your computer and use it in GitHub Desktop.
Save mynameispj/3783395 to your computer and use it in GitHub Desktop.
Get an element's HTML tag with jQuery
$('.getMyHTMLTag')[0].tagName;
//returns 'P'
$('.getMyHTMLTag').prop('tagName');
//returns 'P'
$('.getMyHTMLTag').prop('tagName');
//returns 'P'
<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