<html>
<head>
<title>jQuery Get Tag Name</title>
<script type="text/javascript" src="https://www.jb51.net/jquery-1.3.2.min.js"></script>
</head>
<script type="text/javascript">
$(document).ready(function(){
var $tag = $('p')[0].tagName; //'P'
alert($tag);
var $tag = $('.classTag1')[0].tagName; //'DIV'
alert($tag);
var $tag = $('#idTag1')[0].tagName; //'DIV'
alert($tag);
var $tag = $('p').get(0).tagName; //'P'
alert($tag);
var $tag = $('.classTag1').get(0).tagName; //'DIV'
alert($tag);
var $tag = $('#idTag1').get(0).tagName; //'DIV'
alert($tag);
});
</script>
<body>
<h1>jQuery Get Tag Name</h1>
<p>
This is paragrah 1
</p>
<div>
This is
</div>
<div>
This is
</div>
</body>
</html>